Jump to content

php mysql form ($_GET ID AND Guestid)


-jml-

Recommended Posts

Hy everyone

 

I would like to get some kind of input for a problem I have.

 

I've got a page (A) wich calls an guestid and selects from the DB the data.

Now, I wanna do a Page (B) witch is a form

 

Thing is, I need to bring the Guestid from page (a) to page (B) - also need to have a new ID (ex. clientid) for the form

So far I did it with

 $_GET['id'];
in the page (B) i got:
$id= (isset($_GET['id']) && is_numeric($_GET['id'])) ? $_GET['id'] : 'new';
the thing is, by opening the form I loos the guestid which I need to reecall somehow.

so that there will be at the end:

 

$ID = 'new'

$guestid = $guestid

 

 

for any Inputs I would be more then pleased.

 

Link to comment
Share on other sites

You can save the ID in the session, or you can use hidden form fields to pass that data to the next page along with the rest of the form data.

 

In order to pass it along in hidden fields I need to open a form on page (a)

the thing is I have on page A just a table asking the guest data from the database - page B is where the form is starting - but in order to get the guestid in to the form of page B might just be with session ? or is there any other possibility?

Link to comment
Share on other sites

How is the user getting to page B? If it's a link, then you can pass the ID in the query string.

yes it is a Link <a href="#?ID=<?php echo $ID; ?>

 

site B:

$ID = (isset($_GET['ID']) && is_numeric($_GET['ID'])) ? $_GET['ID'] : 'new';		$ID			= '';		$clientid		= ''; 

what I don't get is how I can pass the clientid with the link or to be able to recall it on site B ?

Link to comment
Share on other sites

You're already passing it in the link, so you get it from $_GET, like you showed. If you then output a form on that page and you want to send the same ID along with the form data, use a hidden form input.

$ID = (isset($_GET['ID']) && is_numeric($_GET['ID'])) ? $_GET['ID'] : 'new';		$ID			= '';
Why set $ID to an empty string if you just got it from $_GET?
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...