Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

HTML Forum


You are currently viewing our HTML Forum as a guest. Please register to participate.
Login



Post a Project »

Find a Professional HTML Freelancer!

Find a Freelancer to help you with your HTML projects

FREE Outsourcing eBook!

Reply
Old 07-11-2005, 08:14 PM form help please
Average Talker

Posts: 28
Trades: 0
i made an order form but i dont know how to make it send the information typed to an email address.

Code:
<html>
<head>
<style type="text/css">
input.text {
font-family: verdana;
font-size: 10px;
border: solid black 1px;}
textarea {
font-family: verdana;
font-size: 10px;
border: solid black 1px;}
</style>
</head>

<body style="
scrollbar-base-color: 73BDBD;
scrollbar-track-color: white;
scrollbar-face-color: white;
scrollbar-highlight-color: white;
scrollbar-3dlight-color: 73BDBD;
scrollbar-darkshadow-color: white;
scrollbar-shadow-color: 73BDBD;
scrollbar-arrow-color: black;">

<font face="verdana" size="1">
<form method="post" action="thanks.htm">
		First name:<br><input type="text" name="fname" class="text"><br>
		Last name:<br><input type="text" name="lname" class="text"><br>
		Email:<br><input type="text" name="email" class="text"><br>
		Address:<br><input type="text" name="address" class="text"><br>
		Apt. #:<br><input type="text" name="aptnum" class="text"><br>
		City:<br><input type="text" name="city" class="text"><br>
		State:<br><input type="text" name="state" class="text"><br>
		Zip code:<br><input type="text" name="zip" class="text"><br>
		Country:<br><input type="text" name="country" class="text"><br><br>
		Means of payment:<br>
		<input type="checkbox" name="check" value="check">Check<br>
		<input type="checkbox" name="moneyorder" value="moneyorder">Money Order<br>
		(choose only one)<br><br>
		Items wanted (list full item name):<br><textarea name="question_text" rows="5" cols="50"></textarea><br><br>
		<center>Before you submit please double check your information.<br>
		<input type="submit" value="submit" style="font-size:8pt; font-family: verdana;"></center>
</font>
</form>
</body>
</html>
i dont know if that was even needed but help would be niiiice. thank you.
makemesick is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 07-11-2005, 09:01 PM
onlyplace4's Avatar
Extreme Talker

Posts: 159
Location: Skegness, Lincolnshire, England
Trades: 0
You need to be using PHP or a CGI program to do this for you. I would suggest the former provided your host has PHP enabled on your server.

Your form needs to point to the script:

<form method="post" action="thanks.php">

Then you need the folowing (this is the start of the file thanks.php):
Code:
<?php
$fname = $_POST['fname'];
$lname = $_post['lname'];
$email = $_POST['email'];
$address = $_POST['address'];
$aptnum = $_POST['aptnum'];
$city = $_POST['city'];
$zip = $_POST['zip'];
$country = $_POST['country'];
$check = $_POST['check'];
if (!$check) { $check = "No"; } else { $check = "Yes"; }
$moneyorder = $_POST['moneyorder'];
if (!$moneyorder) { $moneyorder = "No"; } else { $moneyorder = "Yes"; }
$text = $_POST['question_text'];
$to = you@yourdomain.com;
$subject = "Results from online form";
$message = "First name: ".$fname."\nLast Name: ".$lname."\nEmail: ".$email."\nAddress: ".$address."\nApt# :".$aptnum."\nCity: ".$city."\nZip: ".$zip."\nCountry :".$country."\nPayment : Check - ".$check." or Moneyorder - ".$moneyorder."\nQuery: ".$text."\n";
$headers = "From: OnlineForm <you@yourdomain.com>\n";
mail($to, $subject, $message, $headers);

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
.... rest of your thank you page
That should sort you out. However, you should check that the email address they have supplied is valid, and if it isn't, you should redirect the user back to the form whihc would then alos need to be a PHP page to make sense of the user being sent back.

To check the email address change the relevant part of the code above to:
Code:
$email = $_POST['email'];
if (!eregi ("^([a-z0-9_]|\\-|\\.)+@(([a-z0-9_]|\\-)+\\.)+[a-z]{2,4}$", $email)) {
    header("Location: http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/form.php?err=email");
}
$address = $_POST['address'];
Now put your form on the page called form.php (though you can change this to suit so long as it has the .php suffix). Now that page should read:
Code:
<?php
$error = $_POST['err'];
if (!$error) { $error = 0; }
?>
<html>
<head>
<style type="text/css">
input.text {
font-family: verdana;
font-size: 10px;
border: solid black 1px;}
textarea {
font-family: verdana;
font-size: 10px;
border: solid black 1px;}
</style>
</head>

<body style="
scrollbar-base-color: 73BDBD;
scrollbar-track-color: white;
scrollbar-face-color: white;
scrollbar-highlight-color: white;
scrollbar-3dlight-color: 73BDBD;
scrollbar-darkshadow-color: white;
scrollbar-shadow-color: 73BDBD;
scrollbar-arrow-color: black;">
<?php
if ($error == "email") { echo "<span style=''color:red">The email address you entered did not conform to recognised standards.</span><br>; }
?>
<font face="verdana" size="1">
<form method="post" action="thanks.php">
		First name:<br><input type="text" name="fname" class="text"><br>
		Last name:<br><input type="text" name="lname" class="text"><br>
		Email:<br><input type="text" name="email" class="text"><br>
		Address:<br><input type="text" name="address" class="text"><br>
		Apt. #:<br><input type="text" name="aptnum" class="text"><br>
		City:<br><input type="text" name="city" class="text"><br>
		State:<br><input type="text" name="state" class="text"><br>
		Zip code:<br><input type="text" name="zip" class="text"><br>
		Country:<br><input type="text" name="country" class="text"><br><br>
		Means of payment:<br>
		<input type="checkbox" name="check" value="check">Check<br>
		<input type="checkbox" name="moneyorder" value="moneyorder">Money Order<br>
		(choose only one)<br><br>
		Items wanted (list full item name):<br><textarea name="question_text" rows="5" cols="50"></textarea><br><br>
		<center>Before you submit please double check your information.<br>
		<input type="submit" value="submit" style="font-size:8pt; font-family: verdana;"></center>
</font>
</form>
</body>
</html>
I hope that's clear. I know it looks complex, but it's relatively easy. You can, of course, also check that all the fields have been entered in a similar way, but that's probably getting too complex at this stage.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
onlyplace4 is offline
Reply With Quote
View Public Profile Visit onlyplace4's homepage!
 
Old 07-12-2005, 04:41 PM
Average Talker

Posts: 28
Trades: 0
that didnt quite work.

now im getting this:
http://seamsewswell.t35.com/order/order.htm

note: if you click order itll go to http://seamsewswell.t35.com/order.htm
which is different. & also doesnt send to my email.
makemesick is offline
Reply With Quote
View Public Profile
 
Old 07-12-2005, 06:36 PM
onlyplace4's Avatar
Extreme Talker

Posts: 159
Location: Skegness, Lincolnshire, England
Trades: 0
Can you post the code for the page please and I'll take a look at it. I can't tell what the error is without seeing the php that you have on the page and that, of course, is not delivered with the page.

Thanks.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
onlyplace4 is offline
Reply With Quote
View Public Profile Visit onlyplace4's homepage!
 
Old 07-12-2005, 09:19 PM
Average Talker

Posts: 28
Trades: 0
orderform.php below
Code:
<head>
<style type="text/css">
input.text {
font-family: verdana;
font-size: 10px;
border: solid black 1px;}
textarea {
font-family: verdana;
font-size: 10px;
border: solid black 1px;}
</style>
</head>

<body style="
scrollbar-base-color: 73BDBD;
scrollbar-track-color: white;
scrollbar-face-color: white;
scrollbar-highlight-color: white;
scrollbar-3dlight-color: 73BDBD;
scrollbar-darkshadow-color: white;
scrollbar-shadow-color: 73BDBD;
scrollbar-arrow-color: black;">
<?php
if ($error == "email") { echo "<span style=''color:red">The email address you entered did not conform to recognised standards.</span><br>; }
?>
<form method="post" action="thanks.php">
		First name:<br><input type="text" name="fname" class="text"><br>
		Last name:<br><input type="text" name="lname" class="text"><br>
		Email:<br><input type="text" name="email" class="text"><br>
		Address:<br><input type="text" name="address" class="text"><br>
		Apt. #:<br><input type="text" name="aptnum" class="text"><br>
		City:<br><input type="text" name="city" class="text"><br>
		State:<br><input type="text" name="state" class="text"><br>
		Zip code:<br><input type="text" name="zip" class="text"><br>
		Country:<br><input type="text" name="country" class="text"><br><br>
		Means of payment:<br>
		<input type="checkbox" name="check" value="check">Check<br>
		<input type="checkbox" name="moneyorder" value="moneyorder">Money Order<br>
		(choose only one)<br><br>
		Items wanted (list full item name):<br><textarea name="question_text" rows="5" cols="50"></textarea><br><br>
		<center>Before you submit please double check your information.<br>
		<input type="submit" value="submit" style="font-size:8pt; font-family: verdana;"></center>
</font>
</form>
</body>
</html>
thanks.php below
Code:
<?php
$fname = $_POST['fname'];
$lname = $_post['lname'];
$email = $_POST['email'];
if (!eregi ("^([a-z0-9_]|\\-|\\.)+@(([a-z0-9_]|\\-)+\\.)+[a-z]{2,4}$", $email)) {
    header("Location: http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/form.php?err=email");
}
$address = $_POST['address'];
$aptnum = $_POST['aptnum'];
$city = $_POST['city'];
$zip = $_POST['zip'];
$country = $_POST['country'];
$check = $_POST['check'];
if (!$check) { $check = "No"; } else { $check = "Yes"; }
$moneyorder = $_POST['moneyorder'];
if (!$moneyorder) { $moneyorder = "No"; } else { $moneyorder = "Yes"; }
$text = $_POST['question_text'];
$to = ilovetheused5374@yahoo.com;
$subject = "Results from online form";
$message = "First name: ".$fname."\nLast Name: ".$lname."\nEmail: ".$email."\nAddress: ".$address."\nApt# :".$aptnum."\nCity: ".$city."\nZip: ".$zip."\nCountry :".$country."\nPayment : Check - ".$check." or Moneyorder - ".$moneyorder."\nQuery: ".$text."\n";
$headers = "From: OnlineForm <ilovetheused5374@yahoo.com>\n";
mail($to, $subject, $message, $headers);

?>


<html>
<head>
</head>

<body>
<font face="verdana">
<b>Thank you for your purchase!!</b><br><br>
You will receive an email shortly.
</font>
</body>
</html>
makemesick is offline
Reply With Quote
View Public Profile
 
Old 07-13-2005, 03:40 AM
onlyplace4's Avatar
Extreme Talker

Posts: 159
Location: Skegness, Lincolnshire, England
Trades: 0
I will have a look at this this evening as I have to be out all day (darn meetings). Straight away though I can see two things.

orderform.php is missing the following:

<?php
$error = $_POST['err'];
if (!$error) { $error = 0; }
?>


which should go before the opening <html> tag.

thanks.php has an error in the if (!eregi ( .... statement (probably my fault as I neglected to tell you to change the locator in that). I should be:

if (!eregi ("^([a-z0-9_]|\\-|\\.)+@(([a-z0-9_]|\\-)+\\.)+[a-z]{2,4}$", $email)) {
header("Location: http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/orderform.php?err=email");
}


I'll have a play tonight and let you know what I come up with
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
onlyplace4 is offline
Reply With Quote
View Public Profile Visit onlyplace4's homepage!
 
Reply     « Reply to form help please
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.23924 seconds with 12 queries