Validating Users

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Pavilion
Forum Contributor
Posts: 301
Joined: Thu Feb 23, 2012 6:51 am

Re: Validating Users

Post by Pavilion »

I just looked up Header() function. Correct me if I'm wrong, but in simplistic terms, do header functions allow for "remembering data" from one page/file to the next? I know that question probably slaughtered general terminology, but I'm asking the only way I know how.

Pavilion
temidayo
Forum Contributor
Posts: 109
Joined: Fri May 23, 2008 6:17 am
Location: Nigeria

Re: Validating Users

Post by temidayo »

To retain the initial information, you have 3 options
1. Do not use the redirect function, display the error information and use javascript history.go(-1)
2. Store the information in session($_SESSION), then u can use the redirect function and still get back the user's data
3. in the redirect url, you can contruct user information as query strings, then get them back using the $_GET variable

and lastly, you can merge your files, put the code in register_post.php on top of your html file, then check for a POST BACK
or you can just include the register_post into the html file, that means you will rename your file to .php. In this last case
you do not need a redirect function
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: Validating Users

Post by social_experiment »

Pavilion wrote:But... I'm not sure yow to use this function.
You place it in the contact form; it will have to be a .php file to be able to parse the php code. The code checks if the value of the field has been set and if so it will echo the value into the html form.
Pavilion wrote:I just looked up Header() function. Correct me if I'm wrong, but in simplistic terms, do header functions allow for "remembering data" from one page/file to the next? I know that question probably slaughtered general terminology, but I'm asking the only way I know how.
From the understanding i have of the function, no header() doesn't remember data;
header() is used to send a raw HTTP header.
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
Post Reply