The 1st form will ask for a customer id. The relevant customer will be extracted from a database, then the 2nd form will ask for the new (changed) address to be then updated into the database. I want all this to happen on the same page. I have no problem with the database side of things BUT I just can't get the 2nd form to work properly. Nothing happens. What am I doing wrong ? Here is a sample of the relevant code :
<!DOCTYPE html>
<head><title>Test Page</title></head>
<body>
<h2>Data Collection</h2><p>
<form name="Form1" method="post" action="<?php $_SERVER[ 'PHP_SELF' ]; ?>" >
Enter Customer ID <input type="text" name="cust" >
<br>
<input type="submit" name="submit1" value="Submit ID"><br>
</form>
<form name="Form2" method="post" action="<?php $_SERVER[ 'PHP_SELF' ]; ?>" >
New Address : <input type="text" name="newaddress">
<br>
<input type="submit" name="submit2" value="Submit Address"><br>
</form>
<?php
if ( $_SERVER[ "REQUEST_METHOD" ] == 'POST' ) {
if ( isset ( $_POST[ "submit1" ] ) ) {echo $_POST["cust"];}
if ( $_SERVER[ "REQUEST_METHOD" ] == 'POST' ) {
if ( isset ( $_POST[ "Submit2" ] ) ) {echo $_POST["newaddress"];}
}}
?>
</body>
</html>
The "newaddress" does not echo when 'Submit Address' button is pressed. Karl