form help

This is a discussion on "form help" within the Web Page Design section. This forum, and the thread "form help are both part of the Design Your Website category.



Go Back   Webforumz.com > Main Forums > Design Your Website > Web Page Design

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Mar 2nd, 2006, 19:24
Junior Member
Join Date: Jan 2006
Age: 23
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
form help

hey there, got a problem with a form, it aall works, but in the email i receive from feedback, the form details are in a line one after the other, any chance i can make line by line in the email, i.e.

First name john:
Last Name: smith
feedback: need help


etc

cheers
skyfire
Reply With Quote

  #2 (permalink)  
Old Mar 2nd, 2006, 19:33
craig's Avatar
Reputable Member
Join Date: Sep 2005
Location: Preston, UK
Age: 21
Posts: 381
Thanks: 0
Thanked 0 Times in 0 Posts
Re: form help

Hi skyfire,
are you using php to send the form?? If so you'll need the "\n" to put the next field on a new line. Put your code in a reply but make sure you use the <code> tags, and then we can get to the bottom of the problem!

Craig
Reply With Quote
  #3 (permalink)  
Old Mar 2nd, 2006, 19:33
Junior Member
Join Date: Mar 2006
Location: Munich
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Re: form help

Oh sorry Craig, I just saw the post when I submitted exactly the same answer Plz post the code of the processing script which, probably visible in the "action" part of the <form>-tag
Reply With Quote
  #4 (permalink)  
Old Mar 2nd, 2006, 19:44
Junior Member
Join Date: Jan 2006
Age: 23
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Re: form help

i am using html and css, ive pasted the code below:
Code: Select all
<body background="background.jpg" STYLE="background-repeat: no-repeat; background-attachment: scroll">

<div align="center">
<div align="center">
  <p><img src="logo/logo.gif" width="236" height="212">
      
    <br>
    <br>
    <br>
    <br>
      <a class="head" href="index.htm">Home</a><img src="spacer.gif" height="8" width="25"> <a class="head" href="about.htm">About Us</a><img src="spacer.gif" height="8" width="25"> <a class="head" href="baskets.htm">Baskets</a><img src="spacer.gif" height="8" width="25"> <a class="head" href="contact.htm">Get in Touch..</a><img src="spacer.gif" height="8" width="25"> <a class="head" href="order.htm">Ordering Online?</a>  <br>
     
      <br>
      <br>
      <span class="style10"><br>
  If you would like to get in touch with any questions,</span></p>
  <p class="style10"> please simply fill out the form below, and we will get back to you as soon as possible, </p>
  <p class="style10">or contact us using any of our other contact details,</p>
  <p class="style13">Office: (01224) 480923</p>
  <p class="style13">Mobile: 07706808076</p>
  <p class="style13">Email: claire@heavenlybaskets.co.uk</p>
</div>
<form method="post" action="mailto:you@yourdomain.com">
<INPUT TYPE="hidden" NAME="recipient" VALUE="claire@heavenybaskets.co.uk">
<INPUT TYPE="hidden" NAME="subject" VALUE="Heavenly Baskets Order Form">

<div id="script">
  
<div align="center">
  <legend>Personal Information</legend>
</div>
<table align="center">
<td>
   <p align="center"><label for="first name">First Name: <input type="text" name="firstname" id="firstname" /></label></p>
   <p align="center"><label for="last name">Last Name: <input type="text" name="lastname" id="lastname" /></label></p>
   <p align="center"><label for="email">Your E-mail: <input type="text" name="email" id="email" /></label></p>
</td>
<td>
    <p><label for="Question">Questions<br> <textarea name="question" cols="30" rows="6" id="question"></textarea></label></p>
</td>
</table>            
   <div align="center">
  <input name="submit" type="submit" value="Submit" />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  
  <input type="reset" name="Reset" value="Reset">
   </div>
</form>

Last edited by herkalees; Mar 5th, 2006 at 20:05.
Reply With Quote
  #5 (permalink)  
Old Mar 2nd, 2006, 20:09
Junior Member
Join Date: Mar 2006
Location: Munich
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Re: form help

Quote:
<form method="post" action="private.php?do=newpm&u=3275">
This is what I meant... I need the code of the page "private.php"... plz use the [php] and [/ php] tags, it's much easier that way
Reply With Quote
  #6 (permalink)  
Old Mar 2nd, 2006, 20:21
craig's Avatar
Reputable Member
Join Date: Sep 2005
Location: Preston, UK
Age: 21
Posts: 381
Thanks: 0
Thanked 0 Times in 0 Posts
Re: form help

OK, you need to make one change to your html page,
Get rid of this
HTML: Select all
<form method="post" action="mailto:you@yourdomain.com">
<INPUT TYPE="hidden" NAME="recipient" VALUE="claire@heavenybaskets.co.uk">
<INPUT TYPE="hidden" NAME="subject" VALUE="Heavenly Baskets Order Form">
and replace it with this
HTML: Select all
<form action="feedback.php" method="post">
when you have done that you need to upload a php file onto your server.

Copy and paste the code below, I have changed the script so it uses the fieldnames you use already, however the things i have put in capitals you need to change.
Save this as feedback.php and simply upload it to your server as you would your new html file.
PHP: Select all

<?
// ------------- CONFIGURABLE SECTION ------------------------
 
$mailto 'CHANGE THIS TO YOUR EMAIL' ;
 
$subject "CHANGE THIS TO YOUR SUBJECT" ;
 
$formurl "CHANGE THIS TO WHERE YOUR FORM IS" ;

$errorurl "CHANGE THIS TO SEND YOUR VISITOR TO A PAGE WHEN THERE IS AN ERROR" ;

$thankyouurl "CHANGE THIS TO SEND YOUR VISITOR TO A PAGE WHEN IT IS SUCCESSFUL" ;
// -------------------- END OF CONFIGURABLE SECTION ---------------
$firstname $_POST['firstname'] ;
$lastname $_POST['lastname'] ;
$email $_POST['email'] ;
$question  $_POST['question'] ;
$http_referrer getenv"HTTP_REFERER" );
if (!isset(
$_POST['email'])) {
 
header"Location: $formurl" );
 exit ;
}
if (empty(
$firstname) || empty($lastname) || empty($email) || empty($question) ) {
   
header"Location: $errorurl" );
   exit ;
}
$firstname strtok$firstname"\r\n" );
$lastname strtok$lastname"\r\n" );
$email strtok$email"\r\n" );
if (
get_magic_quotes_gpc()) {
 
$comments stripslashes$question );
}
$messageproper =
 
"This message was sent from:\n" .
 
"$http_referrer\n" "\nFirst Name: " $firstname "\n" "\nLast Name: " $lastname "\nEmail: " $email 
 
"------------------------- Question --------------------------\n\n" .
 
$question .
 
"\n\n------------------------------------------------------------\n" ;
mail($mailto$subject$messageproper"From: \"$name\" <$email>\r\nReply-To: \"$name\" <$email>\r\nX-Mailer: chfeedback.php 2.04" );
header"Location: $thankyouurl" );
exit ;
?>
This should work, let us know the URL of the site so we can see it!

Craig
Reply With Quote
  #7 (permalink)  
Old Mar 2nd, 2006, 20:39
Junior Member
Join Date: Mar 2006
Location: Munich
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Re: form help

Okay, I was just being lazy, that will work, great!
Reply With Quote
  #8 (permalink)  
Old Mar 2nd, 2006, 20:44
craig's Avatar
Reputable Member
Join Date: Sep 2005
Location: Preston, UK
Age: 21
Posts: 381
Thanks: 0
Thanked 0 Times in 0 Posts
Re: form help

Can we see the site?
Reply With Quote
  #9 (permalink)  
Old Mar 2nd, 2006, 21:11
Junior Member
Join Date: Jan 2006
Age: 23
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Re: form help

so when i make these changes, a file will be emailed to me with the feedback details in it yeah?

but the thing is at the ,
form method"post" action:
part is that there is just an email adres in there, dont know why this page displayed, private.php etc

Last edited by skyfire400; Mar 2nd, 2006 at 21:19.
Reply With Quote
  #10 (permalink)  
Old Mar 2nd, 2006, 21:28
Junior Member
Join Date: Mar 2006
Location: Munich
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Re: form help

I don't understand that, then why was it in the code? Do you use Dreamweaver or some other editor like DW? Where was it displayed? In the code section?

Anyway, that's not so important, the script provided by craig should work, so why work with the old one?
Can we see the site when it's ready, please?
Reply With Quote
  #11 (permalink)  
Old Mar 2nd, 2006, 21:32
Junior Member
Join Date: Jan 2006
Age: 23
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Re: form help

in the part craig said the change, the part in capitals, which url for where the form is? and do i put that stuff he said to add in to a sperate file called feedback.php? thats waht im thinkin anyway,
the site is still in deep works, but if you go to

www.heavenlybaskets.co.uk/contact.htm just go to view source, and see if that is of any help to u

Last edited by skyfire400; Mar 2nd, 2006 at 21:35.
Reply With Quote
  #12 (permalink)  
Old Mar 2nd, 2006, 22:00
Junior Member
Join Date: Jan 2006
Age: 23
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Re: form help

this is the full code for the page:

Code: Select all
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>


<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Heavenly Baskets</title>
<META NAME="keywords" CONTENT="baskets, heavenly, gift, gifts, heavenly baskets, aberdeen">
<META NAME="DESCRIPTION" CONTENT="a gift from heaven">

<link rel="stylesheet" href="style.css">
<style type="text/css">
<!--
.style10 {font-size: large; font-family: CygnetRound;}
.style11 {font-size: large; font-family: Arial, Helvetica, sans-serif; }
.style13 {font-size: medium; font-family: Arial, Helvetica, sans-serif; }
-->
</style>
</head>

<body background="background.jpg" STYLE="background-repeat: no-repeat; background-attachment: scroll">

<div align="center">
<div align="center">
  <p><img src="logo/logo.gif" width="236" height="212">
      
    <br>
    <br>
    <br>
    <br>
      <a class="head" href="index.htm">Home</a><img src="spacer.gif" height="8" width="25"> <a class="head" href="about.htm">About Us</a><img src="spacer.gif" height="8" width="25"> <a class="head" href="baskets.htm">Baskets</a><img src="spacer.gif" height="8" width="25"> <a class="head" href="contact.htm">Get in Touch..</a><img src="spacer.gif" height="8" width="25"> <a class="head" href="order.htm">Ordering Online?</a>  <br>
     
      <br>
      <br>
      <span class="style10"><br>
  If you would like to get in touch with any questions,</span></p>
  <p class="style10"> please simply fill out the form below, and we will get back to you as soon as possible, </p>
  <p class="style10">or contact us using any of our other contact details,</p>
  <p class="style13">Office: (01224) 480923</p>
  <p class="style13">Mobile: 07706808076</p>
  <p class="style13">Email: claire@heavenlybaskets.co.uk</p>
</div>
<form method="post" action="mailto:claire@heavenlybaskets.co.uk">
<INPUT TYPE="hidden" NAME="recipient" VALUE="claire@heavenybaskets.co.uk">
<INPUT TYPE="hidden" NAME="subject" VALUE="Heavenly Baskets Order Form">

<div id="script">
  
<div align="center">
  <legend>Personal Information</legend>
</div>
<table align="center">
<td>
   <p align="center"><label for="first name">First Name: <input type="text" name="firstname" id="firstname" /></label></p>
   <p align="center"><label for="last name">Last Name: <input type="text" name="lastname" id="lastname" /></label></p>
   <p align="center"><label for="email">Your E-mail: <input type="text" name="email" id="email" /></label></p>
</td>
<td>
    <p><label for="Question">Questions<br> <textarea name="question" cols="30" rows="6" id="question"></textarea></label></p>
</td>
</table>            
   <div align="center">
  <input name="submit" type="submit" value="Submit" />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  
  <input type="reset" name="Reset" value="Reset">
   </div>
</form>
</body>
</html>

Last edited by herkalees; Mar 5th, 2006 at 20:05.
Reply With Quote
  #13 (permalink)  
Old Mar 2nd, 2006, 22:00
Junior Member
Join Date: Jan 2006
Age: 23
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Re: form help

where it says:
<form method="post" action="private.php?do=newpm&u=3275">
there is an email address where its says "private.php
Reply With Quote
  #14 (permalink)  
Old Mar 5th, 2006, 19:32
craig's Avatar
Reputable Member
Join Date: Sep 2005
Location: Preston, UK
Age: 21
Posts: 381
Thanks: 0
Thanked 0 Times in 0 Posts
Re: form help

I dont understand why you have not used the code I gave you. It works fine, and means your email isnt in viewable code which means you wont get loads of spam. The mailto function in a html page is a bad choice for security reasons.

The URL your form is at is : http://www.heavenlybaskets.co.uk/contact.htm
so this should replace the words in CAPS.
The form does work.

CRaig
Reply With Quote
  #15 (permalink)  
Old Mar 5th, 2006, 20:05
herkalees's Avatar
Highly Reputable Member
Join Date: Jul 2005
Location: Massachusetts, USA
Age: 87
Posts: 576
Thanks: 0
Thanked 0 Times in 0 Posts
Re: form help

I edited your posts. Please use code tags, they are like this, minus the spaces:

[ CODE ] all your content [/ CODE ]
Reply With Quote
  #16 (permalink)  
Old Mar 8th, 2006, 01:39
Junior Member
Join Date: Jan 2006
Age: 23
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Re: form help

the form didnt work craig, dont know why, but the webstie isnt writtn with PHP, sorry for the problems.
Reply With Quote
  #17 (permalink)  
Old Mar 8th, 2006, 02:28
craig's Avatar
Reputable Member
Join Date: Sep 2005
Location: Preston, UK
Age: 21
Posts: 381
Thanks: 0
Thanked 0 Times in 0 Posts
Re: form help

you can easily change this in a htaccess file.

Code: Select all
 Options +FollowSymlinks
 RewriteEngine on
 RewriteRule ^(.*)\.htm$ $1.php [nc]
If you have a htaccess file already just copy and paste the code onto a new line and upload the new file.
If you havn't a htaccess file, create a file in Notepad called htaccess.txt and copy and paste the code. Upload it and then in your FTP change the filename from "htaccess.txt" to just "htaccess" without the .txt
Then your htm pages will parse like PHP pages and the form script will work!!

Craig
Reply With Quote
  #18 (permalink)  
Old Mar 8th, 2006, 22:15
Up'n'Coming Member
Join Date: Mar 2006
Location: East Sussex, UK
Age: 20
Posts: 53
Thanks: 0
Thanked 0 Times in 0 Posts
Re: form help

Thanks for the code craig very useful wasnt able to use the mail() function because my linux server requires a subject header to send out mail.

Thank you!
Reply With Quote
  #19 (permalink)  
Old Mar 9th, 2006, 00:35
Most Reputable Member
Join Date: Aug 2005
Location: North Wales, United Kingdom
Age: 21
Posts: 1,093
Thanks: 0
Thanked 0 Times in 0 Posts
Re: form help

lol :P

Then why wont you write a header?
PHP: Select all

$headers "MIME-Version: 1.0 \r\n";
$headers .= "Content-type: text/html; ";
$headers .= "charset=iso-8859-1\r\n";
$headers .= "From: noreply @ youremail.com\r\n";

$email "sendtothisperson @ email.com";
$message "Email content here";
         
mail($email,'Email Title Here',"$message",$headers); 
Just replace the necessary values with what you want.
Reply With Quote
  #20 (permalink)  
Old Mar 9th, 2006, 07:46
craig's Avatar
Reputable Member
Join Date: Sep 2005
Location: Preston, UK
Age: 21
Posts: 381
Thanks: 0
Thanked 0 Times in 0 Posts
Re: form help

Thats not a problem!!!
Now cough up those Brownies! ha ha

Craig
Reply With Quote
Reply

Tags
form, help

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Hiding / Showing form fields based on previous form input John Alexander Hopper PHP Forum 1 Mar 10th, 2008 11:30
form variable within an iframe component of a form kissfreaque PHP Forum 3 Feb 29th, 2008 13:06
form variable within an iframe component of a form kissfreaque JavaScript Forum 5 Feb 29th, 2008 11:57
[SOLVED] PHP contact form redirect to same form Posie PHP Forum 14 Jan 29th, 2008 20:28
ASP form to check weather a form value is already in the database Andrew1986 Classic ASP 3 Oct 25th, 2007 08:23


All times are GMT. The time now is 13:36.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3