Ask about a PHP problem here.
unemployment
Posts: 165 Joined: Fri May 06, 2011 5:02 pm
Post
by unemployment » Mon May 23, 2011 1:58 pm
How do I pass data entered in by the user from one page to the next? I imagine I would use sessions for this, but I don't really know how to do it.
How do I say... take the data the user typed into the company name field and then run it through this function..
$suggested_companies = fetch_company_by_name($name);
bowersbros
Posts: 534 Joined: Thu May 05, 2011 8:19 pm
Post
by bowersbros » Mon May 23, 2011 1:59 pm
is it sensitive data? eg passwords? CC details?
I don't like to brag, but I wasn't circumcised. I was circumnavigated.
Want to learn something new? Or maybe reinforce what you already know? Or just help out? Please subscribe to my videos:
http://goo.gl/58pN9
unemployment
Posts: 165 Joined: Fri May 06, 2011 5:02 pm
Post
by unemployment » Mon May 23, 2011 2:02 pm
bowersbros wrote: is it sensitive data? eg passwords? CC details?
Nope. Not sensitive.
bowersbros
Posts: 534 Joined: Thu May 05, 2011 8:19 pm
Post
by bowersbros » Mon May 23, 2011 2:03 pm
you could send it via $_GET
its easier than sessions.
I don't like to brag, but I wasn't circumcised. I was circumnavigated.
Want to learn something new? Or maybe reinforce what you already know? Or just help out? Please subscribe to my videos:
http://goo.gl/58pN9
jacek
Site Admin
Posts: 3262 Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:
Post
by jacek » Mon May 23, 2011 2:06 pm
adding a hidden form input may also be easier.
<input type="hidden" name="suggestions" value="<?php echo htmlentities($suggested_companies); ?>" />
for example.
unemployment
Posts: 165 Joined: Fri May 06, 2011 5:02 pm
Post
by unemployment » Mon May 23, 2011 2:17 pm
I guess the real question is... do I even need to manipulate data this way. If a user is creating a company via a form and they enter in the company name, hit submit and that name matches a name in MySQL I want to display the companies that already exist with that name.
This does not bring the user to a new page, but just replaces the current form with suggested companies. I probably don't even need sessions, gets or hidden inputs, right?
UPDATE: Nevermind. Looks like I just need to create a different variable.
jacek
Site Admin
Posts: 3262 Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:
Post
by jacek » Mon May 23, 2011 2:33 pm
unemployment wrote: I probably don't even need sessions, gets or hidden inputs, right?
Doesn't sound like it