PDA

View Full Version : Please help with my form results page


Gail Marie
08-20-2007, 10:54 PM
If anyone can help me with my form retults page! My form lets users register and submit there form information to mysql database and then it sends an email to me. The database part is working great, but the email is not. When i receive the emailed form there is no form field information included in the email:
Example:

New Registration
gtrace@shaw.ca
To: gtrace@shaw.ca

Results form form:

None of the form information is included in the email?

Here is my Code:

I added a call javascrit action to my submit button as follows:

Form Name="schoolregistration"method="post"action="http://www.peiregistration.portraiteventimaging.ca/Sendresults.php">

Here is my Sendresults.php file:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body><?php
//--------------------------Set these paramaters--------------------------

// Subject of email sent to you.
$subject = 'New Regisration';

// Your email address. This is where the form information will be sent.
$emailadd = 'gtrace@shaw.ca';

// Where to redirect after form is processed.
$url = 'http://www.peiregistration.portraiteventimaging.ca/Registration Confirmation Page.html';

// Makes all fields required. If set to '1' no field can not be empty. If set to '0' any or all fields can be empty.
$req = '0';

// --------------------------Do not edit below this line--------------------------
$text = "Results from form:\n\n";
$space = ' ';
$line = '
';
foreach ($_POST as $key => $value)
{
if ($req == '1')
{
if ($value == '')
{echo "$key is empty";die;}
}
$j = strlen($key);
if ($j >= 20)
{echo "Name of form element $key cannot be longer than 20 characters";die;}
$j = 20 - $j;
for ($i = 1; $i <= $j; $i++)
{$space .= ' ';}
$value = str_replace('\n', "$line", $value);
$conc = "{$key}:$space{$value}$line";
$text .= $conc;
$space = ' ';
}
mail($emailadd, $subject, $text, 'From: '.$emailadd.'');
echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">';
?>

edbr
08-21-2007, 03:46 AM
what are the name of the form fields.post the for code

Gail Marie
08-21-2007, 03:47 PM
Here is my code for the form fields:

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "schoolregistration")) {
$insertSQL = sprintf("INSERT INTO table1 (address, city, prov, postal, phonenumber, email, schoolgroup, username, password, `date`, parentgardian, Childa, Childb, Childc, Childd, Childe, Childf, Childg, Childh, Gradea, Gradeb, Gradec, Graded, Gradee, Gradef, Gradeg, Gradeh, Accept, Relation) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['Address'], "text"),
GetSQLValueString($_POST['City'], "text"),
GetSQLValueString($_POST['Prov'], "text"),
GetSQLValueString($_POST['Postal'], "text"),
GetSQLValueString($_POST['Phonenumber'], "text"),
GetSQLValueString($_POST['Email'], "text"),
GetSQLValueString($_POST['schoolgroup'], "text"),
GetSQLValueString($_POST['Username'], "text"),
GetSQLValueString($_POST['Password'], "text"),
GetSQLValueString($_POST['Date'], "date"),
GetSQLValueString($_POST['parentgardian'], "text"),
GetSQLValueString($_POST['Childa'], "text"),
GetSQLValueString($_POST['Childb'], "text"),
GetSQLValueString($_POST['Childc'], "text"),
GetSQLValueString($_POST['Childd'], "text"),
GetSQLValueString($_POST['Childe'], "text"),
GetSQLValueString($_POST['Childf'], "text"),
GetSQLValueString($_POST['Childg'], "text"),
GetSQLValueString($_POST['Childh'], "text"),
GetSQLValueString($_POST['Gradea'], "text"),
GetSQLValueString($_POST['Gradeb'], "text"),
GetSQLValueString($_POST['Gradec'], "text"),
GetSQLValueString($_POST['Graded'], "text"),
GetSQLValueString($_POST['Gradee'], "text"),
GetSQLValueString($_POST['Gradef'], "text"),
GetSQLValueString($_POST['Gradeg'], "text"),
GetSQLValueString($_POST['Gradeh'], "text"),
GetSQLValueString($_POST['Accept'], "text"),
GetSQLValueString($_POST['Relation'], "text"));