makeITfunctional Posted May 22, 2009 Share Posted May 22, 2009 Hi, PHP Freaks! I have a question for you regarding the ability for PHP to carry information over to another page. To explain: This is for a wedding registry website I am constructing. On page one, I have a search field. If you search for Joe Smith, you will then be taken to a dynamically generated PHP & HTML page that displays any Joe Smiths in the database. From there, you could click on the name of the wedding party you wanted and a page would load that would have a photo of the bride and groom couple. Finally, from the photo page, you could click a button again that would load a wedding registry for the couple. I have not pasted the search page, but I am pasting the code for the PHP page that generates the listings of the couples. How can I have it bridge (and remember) the information so that I can add a photo page that then carries the data to the registry page? I have pasted the code here: http://pastie.org/private/iw0obthro1l716uqtppqfa But as the code is, it only will take you to the listing of the people -- I basically need the PHP code to be carried through to subsequent pages, how can I do this? I know this is hard to follow so please ask if you have any questions! Thanks! Link to comment https://forums.phpfreaks.com/topic/159210-solved-carry-php-code-over-to-an-extra-page/ Share on other sites More sharing options...
savagenoob Posted May 22, 2009 Share Posted May 22, 2009 Sorry man, I'm not reading over that code, but just submit a common id of the table via post or get, then just get it on the next page and run another query. Or learn to use $_SESSION to store the info you want passed on. Link to comment https://forums.phpfreaks.com/topic/159210-solved-carry-php-code-over-to-an-extra-page/#findComment-839699 Share on other sites More sharing options...
makeITfunctional Posted May 22, 2009 Author Share Posted May 22, 2009 Hey, savagenoob. Thanks for your help -- you gave me some direction! Yeah, I guess the website code I pasted wasn't necessary. What's the best way to carry over mySQL data using $_SESSION? I appreciate it! Link to comment https://forums.phpfreaks.com/topic/159210-solved-carry-php-code-over-to-an-extra-page/#findComment-839715 Share on other sites More sharing options...
savagenoob Posted May 22, 2009 Share Posted May 22, 2009 something like this.... <?php session_start(); $_SESSION['name'] = "whatever info, field, or varibable you want to pass"; ?> then on every page you do a session_start(), you can call the field by doing something like.... <?php session_start() $name = $_SESSION['name']; //then do a query $example = mysql_query("SELECT * FROM table WHERE name = '$name'")or die(mysql_error()); while(mysql_fetch_assoc($example)){ //pull all the data you need again and display } ?> then you can remove all the session varibales by using session_unset(); hope that helps a little. But passing a common field from a table via a hidden field in a table using get or post works as well like ... <input type="hidden" name="clientid" value="<?php echo $ID ?>"> then just get it on the page you post to. Link to comment https://forums.phpfreaks.com/topic/159210-solved-carry-php-code-over-to-an-extra-page/#findComment-839719 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.