Hello all,
which is the way to let a user choose an option on a page (check boxes), and with this define a value for a variable in the page itself?
I did a form, displayed with a statement to check is other values are set. Is so, a form is displayed. Here the user has two option in order to display stuff on the page. Seems that i don't get how to link the form to the variables values...
OF COURSE IF THERE ARE EXPEMLE AROUND JUST SEND ME THERE...
Thanks all...
Define and submit value for variables in the page - HOW?
Moderators: egami, macek, gesf
You can access to the vars of your form with the following:
if your problem is only the checkbox, here a example how to:
Code: Select all
$myvar = $_REQUEST['myvar'];
if your problem is only the checkbox, here a example how to:
Code: Select all
echo "<input type=checkbox name=myvar value=thevalueofmyvar>";
you want to get value from user and then use the same value of variable in the same php page ?
( if yes you can do by setting the form action to the PHP_SELF and then track that variable/value according to get/post methods)
( if yes you can do by setting the form action to the PHP_SELF and then track that variable/value according to get/post methods)
-
- New php-forum User
- Posts: 19
- Joined: Tue Aug 19, 2003 6:11 am
- Location: An Italian in Brusssels...
I've almost did it, but now i have a problem displaying this string. How i can escape the carhacters? This is the line where i get the error to read the variable?
Code: Select all
print ("<form name=\"status\" method=\"POST\" action=\"issues.php?pn=\".$_GET['pn'].\"\">");
How can i let the script acceptParse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING
Code: Select all
.$_GET['pn'].
:::.. You can't see California without Marlon Brando's eyes ..:::
-
- New php-forum User
- Posts: 19
- Joined: Tue Aug 19, 2003 6:11 am
- Location: An Italian in Brusssels...
Is not a problem of embedding a piece of code. And more over, is not html pure, is displayed via the PHP parser, so there is something to do to let him read
Code: Select all
action="issues.php?pn=".$_GET['pn']."
:::.. You can't see California without Marlon Brando's eyes ..:::
- ruturajv
- php-forum Super User
- Posts: 1279
- Joined: Sat Mar 22, 2003 9:42 am
- Location: Mumbai, India
- Contact:
Tonkpils wrote:This is the line where i get the errorCode: Select all
print ("<form name="status" method="POST" action="issues.php?pn=".$_GET['pn']."">");
How can i let the script acceptParse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRINGto read the variable?Code: Select all
.$_GET['pn'].
Just see your above code you have escaped the charecter but have not closed the string
Code: Select all
print ("<form name="status" method="POST" action="issues.php?pn=" . $_GET['pn']. "">");