Thanks for reply,problem resolved.Actually the <form>tag was placed wrongly.However,when mixed with another dynamic radio button written in PHP,the validation of radio button become failed.
Code:
<script language="JavaScript" type="text/JavaScript">
function formSubmit(ticket)
{
var returnStatus = 1;
if (ticket.rNumber.selectedIndex == 0){
alert("Please select number of ticket!");
returnStatus = 0;
};
else if( !(movieList.time[<?php echo $rows['name']; ?>].checked)){
alert("Please choose screening time!");
returnStatus = 0;
};
else if (returnStatus) {
window.location='home.php';
};
}
</script>
PHP Code:
<?
if (isset($_SESSION['gmemberid'])) {
$tbl_name = "movie";
$result = mysql_query(sprintf('SELECT name,classification,screeningTime FROM %s
LIMIT 7', $tbl_name)) or die('Cannot execute query.');
//$numrow = mysql_num_rows($result);
while ($rows = mysql_fetch_assoc($result)) {
echo '<table width="100%" border="0"><tr><td height="68">
<table width="100%" height="47" border="0">
---------------------------------------------------------------------------------------------------------<br>';
echo '<strong>' . $rows['name'] . ' (' . $rows['classification'] . ')
<br></strong>';
foreach (explode(',', $rows['screeningTime']) as $time) { ?>
<label>
<input type="radio" name="time[<?php echo $rows['name']; ?>]"
value="<?php echo $time; ?>">
<?php echo $time; ?>
</label>
<?php } ?>
<?
}
}
?>
Code:
<form action="" method="post" name="movieList" id="movieList">
.......
.......
<input name="request" type="submit" id="request" value="Submit Request" onclick="formSubmit(document.movieList)">
Bookmarks