aztec Posted August 11, 2010 Share Posted August 11, 2010 Hello Is it possible using PHP to call a new page with the HREF link, then passing a variable via the URL and inserting the variable into 'Page Name' of the new page called. Kind Regards Link to comment https://forums.phpfreaks.com/topic/210471-using-page-name/ Share on other sites More sharing options...
AtlasC1 Posted August 11, 2010 Share Posted August 11, 2010 That's precisely what GET is doing. For example, if you were to go to home.php?pageName=Home, this would automatically create the variable $_GET['pageName'], which would contain the value "Home". Likewise, going to page.php?variable=value, would result in the variable $_GET['variable'] = "value" being created. So, you could use $pageName = $_GET['pageName']; Is this what you mean? -jm Link to comment https://forums.phpfreaks.com/topic/210471-using-page-name/#findComment-1098223 Share on other sites More sharing options...
aztec Posted August 11, 2010 Author Share Posted August 11, 2010 Thanks That is more or less what I want to do. In particular I want to pass an ID number that could then be used to trigger a MySQL database search. Regards Link to comment https://forums.phpfreaks.com/topic/210471-using-page-name/#findComment-1098225 Share on other sites More sharing options...
freeloader Posted August 11, 2010 Share Posted August 11, 2010 Link on page index.php: http://yourhost.com/testpage.php?id=12345 Source code of page testpage.php: $id= $_GET['id']; $sql = "update database set ID = '$id' where page = 'new'"; mysql_query($sql); Link to comment https://forums.phpfreaks.com/topic/210471-using-page-name/#findComment-1098229 Share on other sites More sharing options...
aztec Posted August 11, 2010 Author Share Posted August 11, 2010 Thanks for your input It is not what I want to do but it appears from the input it can be done. I want to pass an id number say id=1 to a standard php page ie index.php and place the id number into pagename. Then I want to use that id number in a mysql query. $a_result = @mysql_query("SELECT id,first_name, fid, mid FROM table_x where id= '$page' Where $page contains the id number. Is this part possible using PHP Regards Link to comment https://forums.phpfreaks.com/topic/210471-using-page-name/#findComment-1098238 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.