SUNIL16 Posted July 16, 2008 Share Posted July 16, 2008 http://localhost/final/view_topic.php?id=1 This is in address bar how can i get id value 1 in next file. Assume page test.php having the addess as shown above. how can i get that id number in getid.php Quote Link to comment https://forums.phpfreaks.com/topic/115042-how-to-get-values-from-address-bar-to-next-page-or-file/ Share on other sites More sharing options...
revraz Posted July 16, 2008 Share Posted July 16, 2008 Use $_GET['id'] Quote Link to comment https://forums.phpfreaks.com/topic/115042-how-to-get-values-from-address-bar-to-next-page-or-file/#findComment-591599 Share on other sites More sharing options...
miseleigh Posted July 16, 2008 Share Posted July 16, 2008 $id=$_REQUEST['id'] would also do it. Quote Link to comment https://forums.phpfreaks.com/topic/115042-how-to-get-values-from-address-bar-to-next-page-or-file/#findComment-591604 Share on other sites More sharing options...
SUNIL16 Posted July 17, 2008 Author Share Posted July 17, 2008 I am not getting values using get post & request also this is how i am passing values from previous page <form name="form1" method="post" action="add_answer.php"> <td> <table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF"> <tr> <td width="18%"><strong>Name</strong></td> <td width="3%">:</td> <td width="79%"><input name="a_name" type="text" id="a_name" size="45"></td> </tr> <tr> <td valign="top"><strong>Answer</strong></td> <td valign="top">:</td> <td><textarea name="a_answer" cols="45" rows="3" id="a_answer"></textarea></td> </tr> <tr> <td> </td> <td><input name="id" type="hidden" value="<?php echo $id; ?>"></td> <td><input type="submit" name="Submit" value="Submit"> <input type="reset" name="Submit2" value="Reset"></td> </tr> </table> </td> </form> i have to get that id number in add_answer.php <?php require("connect.php"); mysql_select_db("mysite",$con)or die("cannot select DB"); $tbl_name="forum_answer"; // Table name // Get value of id that sent from hidden field $id=$_REQUEST['id']; echo $id; mysql_close($con); ?> i am not getting id passed Quote Link to comment https://forums.phpfreaks.com/topic/115042-how-to-get-values-from-address-bar-to-next-page-or-file/#findComment-592383 Share on other sites More sharing options...
miseleigh Posted July 22, 2008 Share Posted July 22, 2008 Could you add a print_r($_REQUEST) statement in add_answer.php and post the results? What you have should be working. Quote Link to comment https://forums.phpfreaks.com/topic/115042-how-to-get-values-from-address-bar-to-next-page-or-file/#findComment-596666 Share on other sites More sharing options...
wildteen88 Posted July 22, 2008 Share Posted July 22, 2008 I am not getting values using get post & request also this is how i am passing values from previous page <form name="form1" method="post" action="add_answer.php"> <td> <table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF"> <tr> <td width="18%"><strong>Name</strong></td> <td width="3%">:</td> <td width="79%"><input name="a_name" type="text" id="a_name" size="45"></td> </tr> <tr> <td valign="top"><strong>Answer</strong></td> <td valign="top">:</td> <td><textarea name="a_answer" cols="45" rows="3" id="a_answer"></textarea></td> </tr> <tr> <td> </td> <td><input name="id" type="hidden" value="<?php echo $id; ?>"></td> <td><input type="submit" name="Submit" value="Submit"> <input type="reset" name="Submit2" value="Reset"></td> </tr> </table> </td> </form> $id should be $_GET['id'] in that code. Quote Link to comment https://forums.phpfreaks.com/topic/115042-how-to-get-values-from-address-bar-to-next-page-or-file/#findComment-596704 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.