how to check a hidden field data

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

Post Reply
eliavozeri
Forum Newbie
Posts: 7
Joined: Sat Sep 19, 2009 1:40 pm

how to check a hidden field data

Post by eliavozeri »

hi i was looking for a way to make the subject understandable but couldn't find the right phrase so here is the deal...
i have a template in which i have a variable called $body.
i have created a file called register.php in which i call the template and set the $body variable to an html table.
in this html table i have a hidden field called registerinfo i want to use this variable as a flag so i can either show the html table if the user hasen't registered yet and if he presses the register button i call the register.php file again and now i want insted of the html table a simple text saying register succesfull.
this is what i did:

Code: Select all

 
extract($_POST); 
 
    if (empty($registerinfo))
        {
            $registerinfo="1";
            $body=$registerTable;
        }
    else
        {
            $body="<font size=1px><b>You have succesfuly registerd<br>";
        }
 
 
include_once("template.php");
 
now i do understand that useing the extract($_post) could cause breeches in security i don't mind that right now.
and if someone could explain to me the difference between include and include_once i would be happy.
what should i use? as they both work with no problem.
thanks for the help
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: how to check a hidden field data

Post by requinix »

The question is whether to use include or include_once?

include() will let you include the same file more than once. include_once() will not. You decide.

Personally, I would use include() if I needed the file to do something for me. Immediately. Like if, instead of functions, you had lots of files with code*. I don't use include_once because in cases where I would use it I'd actually use require_once instead.

* Do. Not. Use. This. Method.
eliavozeri
Forum Newbie
Posts: 7
Joined: Sat Sep 19, 2009 1:40 pm

Re: how to check a hidden field data

Post by eliavozeri »

ok thanks for the info the question though was the above statment
the part about the include is just one more thing i added to the post. it kind of drove me nuts to see both work and not understand what i should use.
Post Reply