php - Handling multiple forms and printing content -
hi have issue desired output of following code. need print you hit t--
message whilst see form 2 here!
message along button.
but happens when click t--
button message appears form 2 here
content button disappears. need message on screen visible whilst message you hit t--
prints.
can 1 pls highlight how correct this? many looking
here goes code:
<doctype html> <html> <head> <title></title> </head> <body> <div id="one" style="width:300px; background:gray;"> <form method="post" action="<?= $_server['php_self'] ?>"> <input type="text" name="txt1" id="txt1"> <?php if(isset($_post['sendone'])) {echo "<input type='submit' name='sendtwo' id='sendtwo' value='two'>";} ?> <input type="submit" name="sendone" id="sendone" value="one"> </form> </div> <div id="two" style="width:300px; background:yellow;"> <?php if(isset($_post['sendtwo'])) {echo "form 2 here!"; ?> <form method="post" action="<?= $_server['php_self'] ?>"> <?php echo "<input type='submit' name='sendt' id='sendt' value='t--'>";} if(isset($_post['sendt'])) {echo "you hit t--"; return;} ?> </form> </div> </body> </html>
if got right, print message when post ether sendtwo or sendt.
if(isset($_post['sendtwo']) || isset($_post['sendt'])) { echo "form 2 here!"; ?> }
here's example.
Comments
Post a Comment