Jump to content

[SOLVED] Carry PHP Code Over to an Extra Page?


Recommended Posts

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.