load php script within php
Posted: Sun Oct 02, 2005 11:51 pm
I have an HTML form that has input fields and a submit button. Upon submission I would like to first check that all fields have been filled in, and if so, the load the next php file. The problem is that I have a function setup to check my fields after submission so I need to set my form's action to my first php page. If all fields are filled in, then I need to pass variables to my next script. How can I this be done through php (or javascript)?
here is my current php code:
Your help is greatly appreciated!!!
here is my current php code:
Code: Select all
<html>
<head>
<title>Place Order</title>
</head>
<body>
<?php function show_form($first="",$last="") { ?>
<form method="post" action="THISPAGE.php" enctype="multipart/form-data">
<div align="left"><strong>PLACE ORDER</strong></div>
<table>
<tr>
<th>First Name</th>
<th>
<input type="text" name="first" value="<?php echo $last ?>" size="20">
</th>
</tr>
<tr>
<th>Last Name</th>
<th>
<input type="text" name="last" value="<?php echo $last ?>" size="20">
</th>
</tr>
<tr>
<th>
<th>
<input type="submit" name="next" value="Continue>>">
</th>
</tr>
</table>
</div>
</form>
<?php }
if(!isset($first)) {
show_form();
}
else {
if(empty($first) or empty($last)) {
echo "You did not fill in all the
fields, try again<p>";
show_form($first,$last);
}
else {
!!!NEED TO LAUNCH NEXTPAGE.PHP HERE IF ALL FIELDS ARE FILLED IN!!!
//header('Location: NEXTPAGE.php');
//echo "NEXTPAGE.php?last=$last&first=$first"
}
}
?>
</body>
</html>