Welcome to WebmasterWorld Guest from 3.233.226.151

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

getting info from form to script

     
2:04 pm on Jun 7, 2005 (gmt 0)

Full Member

10+ Year Member

joined:Mar 27, 2004
posts:276
votes: 0


I having a hard time to get information from a form to a script. I have an image on one page that Im trying to get the name transfered to the script to be emailed out. Most of the script is a self posting except the info coming from the image form. Her is some coding
###################
HTML Form
<td width="100%" bgcolor="#FFFFFF" height="19">
<form method="post" action="http://www.mysite.com/sendinfo.php">
<input type="hidden" name="tagrequest" value="pmstemptag">
<p align="center"><input type="image" src="pmstemptag.jpg" width="353" height="324">
<p align="center"><font size="6"><b>#6</b></font>
</form></td>
##########################
PHP script
<?php
if(isset($_POST['submit_form'])) {



# error checking
if(!$_POST['name']) {
$error1 = '<p>Please Fill in the Name field</p>';
} /*check to make sure name is filled in, if not display error message on form as error1*/
if(!$_POST['email']) {
$error2 = '<p>Please fill in the email field</p>';
} /*check to make sure email is filled in, if not display error message on form as error2*/

if(!$_POST['namerequested']) {
$error3 = '<p>Please fill in the name you would like on your tag</p>';
} /*check to make sure a suggestion is filled in, if not display error message on form as error3*/
if(!$_Post['tagrequest'])

if(!$error1 &&!$error2 &&!$error3) {

$toaddress = 'dee@mysite.com';
$subject = 'Tag Request';
$mailcontent = 'Customer name: '.$name."\n"
.'Customer email: '.$email."\n"
.'Tag requested: '.$tagrequest."\n"
.'Name on Tag: '.$namerequested."\n";


$fromaddress = 'From: discussions@mysite.com';

if (mail($toaddress, $subject, $mailcontent, $fromaddress))
header("Location: thankyou.php"); //error testing ended
}
#############################
Then under that in the script is the form with the other information on it. I cant seem to get this
<input type="hidden" name="tagrequest" value="pmstemptag">
from the first form to the script to be included in the email
Anyone see what Im missing
Pat

3:13 pm on June 7, 2005 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Nov 26, 2003
posts:1133
votes: 0


if($tagrequest = $_POST["tagrequest"])
{...
$mailcontent = "Customer name: ".$name."\n"
."Customer email: ".$email."\n"
."Tag requested: ".$tagrequest."\n"
."Name on Tag: ".$namerequested."\n";

echo $mailcontent;//to check the content.

It's not safe to set the auto variable from $_POST and $_GET. better to assign them manually!

Moreover you forgot the parenthesis { after your if(!$target...) but if it's not set, then why do you use it?

Best regards
Michal Cibor