using foreach to validate form info, then send to URI
Posted: Sat Sep 23, 2006 1:10 am
I hope that title is descriptive enough, otherwise I did honestly try to abide by the forum rules. However, this code is as the title suggests foreach loops to validate input, if its validated (this is where my problem is, well one of them), I want to send the user to the next page. admin.php
Thanks for any help.
Thanks for any help.
Code: Select all
<?php
$admin = "<a href=" . $_SERVER['PHP_SELF'] . "?admin.php";
$submit = 0;
$user = "sean";
$pass = "butchy";
$submit2 = 0;
foreach ($_POST as $user => $value)
{
if (!$value)
{
echo '<h2>The form field ' . $user . ' did match please try again. Thank you!</h2>';
$submit++;
}
}
foreach ($_POST as $pass => $value2)
{
if (!value2)
{
if($submit > 0)
{
if($submit2 > 0)
{
if ($_POST['submit']) {
$admin;
} else {
die();
}
?>
<form method="POST" action="pass.php">
<p><b>Date</b><input type="text" value="<b><?php echo date('F j, Y, g:i a');?></b>" name="date" size="30">
<p><b>Your name</b>
<input type='text' value="<?php echo $value1;?>" name='name' size='30'></p>
<p><b>Your email</b>
<input type='text' value="<?php echo $value1;?>" name='email' size='30'></p>
<p><b>article title</b>
<input type='text' value="<?php echo $value1;?>" name='title' size='30'></p>
<p><b>article</b>
<TEXTAREA NAME='article' COLS='120' ROWS='20' WRAP='virtual'></TEXTAREA></P>
<p><b><input type="submit" value="submit your aritlce" name="submit">
</b></p>
<?php
}
}
}
}
?>