form field info not transfering to my check page?

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
romanbills
Forum Newbie
Posts: 8
Joined: Thu May 11, 2006 2:00 pm

form field info not transfering to my check page?

Post by romanbills »

the subject sums it all up. On a registration form on my website you fill in the information upon clicking the submit button it posts to the check page...however it will not transfer the information to the check page? Iv never seen this befor and ready to pull my hair out...any suggestions??
jcherry
Forum Newbie
Posts: 5
Joined: Thu May 11, 2006 4:04 pm

Post by jcherry »

Are you sure that you have method="post" declared in your form tag?

Could you post some code samples with this? More information would help to answer this since it could be a lot of things.
romanbills
Forum Newbie
Posts: 8
Joined: Thu May 11, 2006 2:00 pm

Post by romanbills »

thats the first thing i checked...if you dont mind helping me contact me on aol at norcal0816
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Why not post your code for the community to see? It makes it better for all of us if we can work on the problem together and arrive at a solution together.

On a side note, have you cleared your cache and deleted your cookies? Have you also checked for the presence of the POST array, or a single value of the post array? Lastly, have you tried switching from $HTTP_POST_VARS to $_POST or vice versa depending on your PHP version?
jcherry
Forum Newbie
Posts: 5
Joined: Thu May 11, 2006 4:04 pm

Post by jcherry »

Everah, you make a good point. I think that he needed to keep his code semi-private, as it seemed as though he is doing this for a client. I will post the solution I gave to him over instant messenger. It was a pretty easy solution.

In order to use local variables (ie $var) that are posted from a form, you either need to assign the variable yourself or turn register_globals on (NOT RECOMMENDED).

Here is a sample:

Code: Select all

$var = $_POST["form_variable"];
//or
$var = $HTTP_POST_VARS["form_variable"];
If you do not do this, you will not be able to access variables that are posted from your form.

Regarding register_globals, turning this on in php.ini will automatically convert your post/get variables into local variables for you. Sounds nice and easy, however there are large security risks intriduced into your script so it it strongly not recommended. In addition, PHP6 will be removing this option entirely from PHP, so you will have to change any scripts that are depended on register_globals anyways.
Post Reply