Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hello
I am having a tough time with radio buttons. All I want to accomplish is this :
I have queried and got a set of place names from my mysql db and i have listed it in php form with the use of radio buttons. When the user clicks on a radio button, i want to capture the onclick event and i want to send the info regarding which button was clicked to the server. And also display the form again with the selected radio button. I do not want to use submit button here because this happens in the middle of a long data entry form and I have a submit button at the end of that form.Code: Select all
while($placeRecord= mysql_fetch_array($placeSet)){
echo "<input type='radio' name='placeChoice' value='$placeRecord[locationID]' onClick='reloadWPlace(this.form);'";
}Code: Select all
function reloadWPlace(form){
var placeVal=0;
var i;
for(i = 0; i < document.dataEntry.placeChoice.length; i++ )
{
if( document.dataEntry.placeChoice[i].checked == true )
placeVal = document.dataEntry.placeChoice[i].value;
}
self.location='dataEntry.php?placeChoice=' + placeVal; // append selectes place to address bar
}Code: Select all
echo "<br/>List of Places<br/><br/>";
while($placeRecord= mysql_fetch_array($placeSet)){
echo "<input type='radio' name='placeChoice' value='$placeRecord [locationID]' onClick='reloadWPlace(this.form);'";
if ($placeRecord['locationID'] == $selPlace) {
echo "checked";
}
echo ">";
echo "<a href='placeDetails.php?id=$placeRecord[locationID]' onClick=\"return popup(this, 'Details')\">$placeRecord[place]</a><br/>";
}feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]