variable transmission problem from php form

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
User avatar
orangeapple
Forum Commoner
Posts: 70
Joined: Tue Jan 06, 2004 1:24 pm
Location: Geneva / Switzerland

variable transmission problem from php form

Post by orangeapple »

Hi.

have a problem with the transmission of a variable which is not in a field from a php form to a php file. This syntax :

<form name="FormName" action="newuseranswer.php?randompass=$randompass" method="post">

doesn't work, the variable randompass isn't transmitted.

Who can help ?
User avatar
Dr Evil
Forum Contributor
Posts: 184
Joined: Wed Jan 14, 2004 9:56 am
Location: Switzerland

Post by Dr Evil »

You can not send a variable in the URL (GET) as you send a form (POST).
Instead you must create a hidden field in your form:

Code: Select all

<input type="hidden" name="randompass" value="<?=$randompass;?>">
Hope this helps.

Tu es à Genève ? Où ça ?


Dr Evil
User avatar
orangeapple
Forum Commoner
Posts: 70
Joined: Tue Jan 06, 2004 1:24 pm
Location: Geneva / Switzerland

Post by orangeapple »

Nickel, merci !

Suis à Vernier, vers Balexert.
Et toi ?
User avatar
Dr Evil
Forum Contributor
Posts: 184
Joined: Wed Jan 14, 2004 9:56 am
Location: Switzerland

Post by Dr Evil »

Your welcome !

Je suis à Nyon.
McGruff
DevNet Master
Posts: 2893
Joined: Thu Jan 30, 2003 8:26 pm
Location: Glasgow, Scotland

Post by McGruff »

Ah I should have paid more attention in French classes.

The only things I (half) remember are:

"vous ette un supair nana!"

and:

"vous ette un [censored] de chevalier!"

You can probably guess the kind of school I went to, and the kind of trouble I landed in when I got them mixed them up.
Post Reply