my form html code =
<form method="GET" action=Check_email.php? action=mailMe>
<tr>
<td align="left" width="167" height="38">Please enter your first name here:
</td>
<td align=left width="322" height="38"><font face="Arial" color="#C0C0C0">
<input type="text" color="white" name="Fname" size=63 maxlength=40></font>
</td>
</tr>
<tr>
<td width="167" height="1">
</td>
</tr>
<tr>
<td align="left" width="167" height="41">Please enter your email address here:
</td>
<td align=left width="322" height="41"><font face="Arial" color="#C0C0C0">
<input type="text" color="white" name="Email" size=63 maxlength=40></font>
</td>
</tr>
<tr>
<td width="167" height="1"></td>
</tr>
<tr>
<td align=left width="322" height="26"><font face="Arial" color="#C0C0C0">
<input type=submit value="Submit Your Details" style="color: #000000"></font></td>
</tr>
</form>
my check_email php (this checks for valid email from html page- if correct then go to jcorrect.php and update database)=
<?php
$Fname = $GET['Fname'];
$Email = $GET['Email'];
$correct = 'Jcorrect.php';
$incorrect = 'Jincorrect.php';
$result = TRUE;
if (!eregi("[a-z0-9-]+(.[a-z0-9-]+)@[a-z0-9-]+(.[a-z0-9-]+)(.[a-z]{2,4})$", $_GET['Email']))
{
header("Location: http://www.pokit-shop.com/$incorrect");
}
else {
header("Location: http://www.pokit-shop.com/$correct");
}
exit;
?>
code in my jcorrect.php(as above)= (this should update database but no data passsed form through from check_email.php so data base always enters a black record).
<?php
include('check_email.php');
$emailus = 'info@MYSITE.com';
$Fname = $GET['Fname'];
$Email = $GET['Email'];
?>
html code inbetween
<?php
//----------------- Ipdate Database --------------
//mysql_connect to database
$connect = mysql_connect("localhost","USERNAME","PASSWORD") or die(mysql_error());
//mysql_select database
mysql_select_db("DATABASE", $connect) or die(mysql_error());
//mysql_incert data into database
$sql = mysql_query("INSERT INTO `TABLE` (`Fname`, `Email`) VALUES ('$_GET['Fname']', '$_GET['Email']')");
if (!$sql) { echo mysql_error(); }
// ---------------- SEND MAIL FORM ----------------
// send e-mail to
$to = $_GET['Email'];
// Your subject
$subject="From www.MYSITE.com";
// Message
$message="Thank you for registering your details, we will send you a free online brochure shortly. ";
// From - $header="From: Your-Name <info@MYSITE.com>";
$header="From: <info@MYSITE.com>";
// send email
$sentmail = mail($to,$subject,$message,$header);
// error handeling
if($sentmail){
echo "Acknowledgement email sent";
}else{
echo "Cannot send Confirmation e-mail";
}
?>