Page 1 of 1
Need some help to get the value
Posted: Wed Feb 19, 2003 8:31 am
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
Posted: Wed Feb 19, 2003 9:37 am
by jason
Read this:
viewtopic.php?t=1030
And then reevaluate your question.
Posted: Wed Feb 19, 2003 9:41 am
by wizzard
So this means you cannot get the value of a form object and put it in var of php.
Posted: Wed Feb 19, 2003 10:17 am
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'];}
?>