shashv — 2012-07-03T08:28:46-04:00 — #1
I want to connect the hyper of the new page to the onclick event of the radio button.
The web page is developed in php and syntax is as follows
echo """<input class="radio" type="radio" name="alg_Type" id="HP" value="HP" onclick="location.href='highP.php'"/><label class="choice" for="HP">High precision</label>""";
and I get the following error
Parse error: parse error, expecting
Any help would be appreciated.
paulob — 2012-07-03T15:41:02-04:00 — #2
I don't know anything about php (so I've no idea why I posted here) but shouldn't you be escaping the quotes inside the html or at least using double quotes on the outside and single quotes inside.
echo "<input class='radio' type='radio' name='alg_Type' id='HP' value='HP' onclick=\\"location.href='highP.php'\\"/><label class='choice' for='HP'>High precision</label>";
Of course there's bound to be a much better way to do this.
serenarules — 2012-07-03T17:03:24-04:00 — #3
I agree with the above. Navigation using a radio button like that is a bad design decision. For one thing, they aren't meant for navigation, and another thing, it offers no more advantage than writing out a list of links. Use elements for their intended purposes. Radio buttons are form elements, designed to capture a decision, and then submitting it. Anchors are for navigation. Can it be done? Of course, but then again, you can use a crowbar to open your front door instead of your key, but why would you?
shashv — 2012-07-04T05:46:31-04:00 — #4
Thanks for the replies!
I am sorry for not framing my question correctly. I am using two radio buttons. So when the radio button is selected, the page refreshes and uploads the different set of data. I was looking through the web and found that this is one of the ways to do it. Please let me know if there is a better to way to do it. I would appreciate any ideas or suggestions.
echo '<TR ><TD><input class="radio" type="radio" name="alg_Type" id="HP" value="HP" onclick="location.href=\\'highHp.php\\'"/>
<label class="choice" for="HP">High precision</label></TD></TR>';
echo '<TR ><TD><input class="radio" type="radio" name="alg_Type" id="HR" value="HR" onclick="location.href=\\'highHR.php\\'" />
<label class="choice" for="HR">High recall</label></TD></TR>';
serenarules — 2012-07-04T11:19:59-04:00 — #5
Is the content of highHP and highHR being displayed under the radio buttons or just being uploaded to the server itself? Either way it's still a bad idea. I'd use a <select> dropdown to let the user choose (saves space on screen) with a small "GO" input button beside it to submit the form.
shashv — 2012-07-04T11:26:33-04:00 — #6
Thanks for the reply. Yes, there are two sets of data, so with the change of selection the displayed data set changes. I will try implementing the way you have suggested.