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 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'] 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. 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 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. 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. 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
Archived
This topic is now archived and is closed to further replies.