volvo
asked on
input type=radio question
Hello
I have a field in my table that is called "template" and i have a form with 3 radio buttons.
When the form is loaded it has to check a radio button depending on the value.
When i submit the form it has to write the value into my table field "template".
The code i try to use looks like:
echo "<input type=radio value=1 name=template ".if ($row[template]==1) echo "checked".">";
echo "<input type=radio value=2 name=template ".if ($row[template]==2) echo "checked".">";
echo "<input type=radio value=3 name=template ".if ($row[template]==3) echo "checked".">";
Why does this not work:
I always get a parse error
I have a field in my table that is called "template" and i have a form with 3 radio buttons.
When the form is loaded it has to check a radio button depending on the value.
When i submit the form it has to write the value into my table field "template".
The code i try to use looks like:
echo "<input type=radio value=1 name=template ".if ($row[template]==1) echo "checked".">";
echo "<input type=radio value=2 name=template ".if ($row[template]==2) echo "checked".">";
echo "<input type=radio value=3 name=template ".if ($row[template]==3) echo "checked".">";
Why does this not work:
I always get a parse error
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Glad to have helped. :o)
Thanks for the A!
Ant
Thanks for the A!
Ant
echo "<input type=radio value=1 name=template" . ($row[template]==1) ? " checked" : "" . ">";
etc