Form Post Method, $_Get in Form Post Action |
Form Post Method, $_Get in Form Post Action |
Freshman |
Dec 19 2018, 08:54 AM
Post
#1
|
Newbie Group: Members Posts: 12 Joined: 19-December 18 Member No.: 26,776 |
Hi all,
I'm very new to HTML and PhP but learning as I go. In code below I would like to 'insert' the id (from the URL) to the Action in the Form Post method. As you will see I tried to pass the $id value into the Action but it is not working. If I hardcode the correct value then all my following code work 100% URL would be something like: www.mydomain.com/add.html?id=123 CODE <?php //getting id from URL $id = $_GET['id']; ?> <html> <head> <title>Add Data</title> </head> <body> <br/><br/> <form method="post" name="form1" action="addrec.php?id="&<?php echo $id;?>> <table width="25%" border="0"> <tr> <td>Day <?php echo $id;?> N </td> <td><input type="text" name="HDay"></td> </tr> <tr> <td>Month</td> <td><input type="text" name="HMonth"></td> </tr> <tr> <td>Relation</td> <td><input type="text" name="Relation"></td> </tr> <tr> <td></td> <td><input type="submit" name="Submit" value="Add"></td> </tr> </table> </form> </body> </html> |
Lo-Fi Version | Time is now: 25th April 2024 - 10:24 PM |