I've taken the code from the 2.09 download and tried to insert it into a form which I've already set up. However, I consistently get a error generated by the PHP:
The following errors occured while processing your form input.
* You did not enter one or more of the required fields. Please go back and try again.
* Invalid email address entered
Can anyone spot an obvious mistake please? I'm sure there's something I haven't got covered.
<?php
include("global.inc.php");
$errors=0;
$error="The following errors occured while processing your form input.<ul>";
pt_register('POST','name');
pt_register('POST','email');
pt_register('POST','adate');
pt_register('POST','ddate');
pt_register('POST','people');
pt_register('POST','pets');
if($name=="" || $email=="" || $adate=="" || $ddate=="" ){
$errors=1;
$error.="<li>You did not enter one or more of the required fields. Please go back and try again.";
}
if(!eregi("^+(+)*" ."@"."(+(+)*)+"."\\.{2,}"."$",$email)){
$error.="<li>Invalid email address entered";
$errors=1;
}
if($errors==1) echo $error;
else{
$where_form_is="http".($HTTP_SERVER_VARS=="on"?"s":"")."://".$SERVER_NAME.strrev(strstr(strrev($PHP_SELF),"/"));
$message="Name: ".$name."
Email: ".$email."
Arrival Date: ".$adate."
Departure Date: ".$ddate."
No of People: ".$people."
Pets: ".$pets."
";
$message = stripslashes($message);
mail("my@email.com","Form Submitted at your website",$message,"From: phpFormGenerator");
$make=fopen("admin/data.dat","a");
$to_put="";
$to_put .= $name."|".$email."|".$adate."|".$ddate."|".$people."|".$pets."
";
fwrite($make,$to_put);
?>
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
"You did not enter one or more of the required fields. Please go back and try again."
One of these fields are blank.
$name=="" || $email=="" || $adate=="" || $ddate==""
"Invalid email address entered"
The email address you entered does not fit the regular expression below.
"^+(+)*" ."@"."(+(+)*)+"."\\.{2,}"."$"
If you still need help you will need to send me a zip of your form folder and all contents.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I've taken the code from the 2.09 download and tried to insert it into a form which I've already set up. However, I consistently get a error generated by the PHP:
The following errors occured while processing your form input.
* You did not enter one or more of the required fields. Please go back and try again.
* Invalid email address entered
Can anyone spot an obvious mistake please? I'm sure there's something I haven't got covered.
This is the HTML:
<form enctype='multipart/form-data' action='process.php' method='post'>
<span class="style2">Make a Booking Enquiry </span>
<br />
<br />
<span class="style1">Name: </span><input type=text name="name" value="yourname" size="22" />
<br />
<br />
<span class="style1">email: </span><input type=email name="email" value="youremail" size="22" />
<br />
<br />
<span class="style1">Arrival: </span><input type=text name="adate" value="DD/MM/YYYY" size="22" />
<br />
<br />
<span class="style1">Departure: </span><input type=text name="ddate" value="DD/MM/YYYY" size="22" />
<br />
<br />
<span class="style1">No. of people: </span>
<select name="people">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
</select>
<span class="style1">Pets: </span><input type=checkbox name="pets" />
<br />
<br />
<input type ="submit" value ="Submit" />
</form>
And this is the PHP:
<?php
include("global.inc.php");
$errors=0;
$error="The following errors occured while processing your form input.<ul>";
pt_register('POST','name');
pt_register('POST','email');
pt_register('POST','adate');
pt_register('POST','ddate');
pt_register('POST','people');
pt_register('POST','pets');
if($name=="" || $email=="" || $adate=="" || $ddate=="" ){
$errors=1;
$error.="<li>You did not enter one or more of the required fields. Please go back and try again.";
}
if(!eregi("^+(+)*" ."@"."(+(+)*)+"."\\.{2,}"."$",$email)){
$error.="<li>Invalid email address entered";
$errors=1;
}
if($errors==1) echo $error;
else{
$where_form_is="http".($HTTP_SERVER_VARS=="on"?"s":"")."://".$SERVER_NAME.strrev(strstr(strrev($PHP_SELF),"/"));
$message="Name: ".$name."
Email: ".$email."
Arrival Date: ".$adate."
Departure Date: ".$ddate."
No of People: ".$people."
Pets: ".$pets."
";
$message = stripslashes($message);
mail("my@email.com","Form Submitted at your website",$message,"From: phpFormGenerator");
$make=fopen("admin/data.dat","a");
$to_put="";
$to_put .= $name."|".$email."|".$adate."|".$ddate."|".$people."|".$pets."
";
fwrite($make,$to_put);
?>
"You did not enter one or more of the required fields. Please go back and try again."
One of these fields are blank.
$name=="" || $email=="" || $adate=="" || $ddate==""
"Invalid email address entered"
The email address you entered does not fit the regular expression below.
"^+(+)*" ."@"."(+(+)*)+"."\\.{2,}"."$"
If you still need help you will need to send me a zip of your form folder and all contents.