Need some help to get the value

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
wizzard
Forum Commoner
Posts: 93
Joined: Thu May 16, 2002 5:36 am
Location: Belgium
Contact:

Need some help to get the value

Post by wizzard »

Hi,

i want to get the values out of of a form object.

like $cat = document.form1.category.value

but it doesn't works :(

Cheers
Kris
jason
Site Admin
Posts: 1767
Joined: Thu Apr 18, 2002 3:14 pm
Location: Montreal, CA
Contact:

Post by jason »

Read this: viewtopic.php?t=1030

And then reevaluate your question.
wizzard
Forum Commoner
Posts: 93
Joined: Thu May 16, 2002 5:36 am
Location: Belgium
Contact:

Post by wizzard »

So this means you cannot get the value of a form object and put it in var of php.
User avatar
daven
Forum Contributor
Posts: 332
Joined: Tue Dec 17, 2002 1:29 pm
Location: Gaithersburg, MD
Contact:

Post by daven »

Pretty much. PHP is serverside, so you cannot set variables using client-side interactions. The only way to set the variables like you want is to create a form and use the form values. Ex:

Code: Select all

<form action="$_SERVERї'PHP_SELF']" method="POST">
<input type="text" name="var1" value="value1">
<input type="text" name="var2" value="value2">
<input type="submit" value="submit">
</form>

Code: Select all

<?php
if(isset($_POST['var1'])){$myvar1=$_POST['var1'];}
if(isset($_POST['var1'])){$myvar2=$_POST['var2'];}
?>
Post Reply