Forum Moderators: coopster
If they do not, they get the "error" postback. BUT, i have it in a "die" statement...and when it does that, the error page shows up in a new blank page, outside of my template...
how can i re-arrange my statement to keep it within the template..? i tried just echo'ing it, but it only showed the error at all times....
************************************************************
if (isset($_POST['submit']))
{
if (!$_POST['fname'] ¦!$_POST['lname'])
{ //show user error
die('<table>
<tr><td>Error, must enter last and first name.</td></tr>
</table>');
}
$fname = $_POST['fname'];
$lname = $_POST['lname'];
$query = "INSERT INTO (.....
VALUES ...'$fname','$lname'...)";
mysql_query($query);
mysql_close();
?>
//Show user successful entry
<table>
<tr><td><h1>Successful Lead Entry</h1></td></tr>
</table>
<?php
}
else
{
?>
<table>
<form>User Form for data entry goes here.
</form>
</table>
<?php
}
?>
<?
if (isset($_POST['submit']))
{
if (!$_POST['fname'] ¦!$_POST['lname'])
{ //show user error
('<table>
<tr><td>Error, must enter last and first name.
<!-- Do not test both in bulk, rather do it one at a time with its pertaining error message -->
</td></tr>
</table>');
exit();
}
else
{
$fname = $_POST['fname'];
$lname = $_POST['lname'];
$query = "INSERT INTO (.....
VALUES ...'$fname','$lname'...)";
mysql_query($query);
mysql_close();
print<<<success
<table>
<tr><td><h1>Successful Lead Entry</h1></td></tr>
</table>
success;
}
?>
<table>
<form>User Form for data entry goes here.
</form>
</table>
<?
$fname=$_POST['fname'];
$lname=$_POST['lname']
if (isset($_POST['fname']) &&!empty($_POST['fname']) && isset($_POST['lname']) &&!empty($_POST['lname']) )
{
$query = "INSERT INTO (.....
VALUES ...'$fname','$lname'...)";
mysql_query($query);
mysql_close();
print<<<success
<table>
<tr><td><h1>Successful Lead Entry</h1></td></tr>
</table>
success;
}
else
{
('<table>
<tr><td>
Error, must enter last and first name.
</td></tr>
</table>');
exit();
}
?>
>>>>>