Hi! I had made a parent php file and there is a link to a popup. I will choose the time in the popup and be displayed in my parent file.
Parent php file: RegisterStudent.php is a form
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Register Student</title>
</head>
<body>
<form name="f1" method="post">
<table width="100%" border="0">
<tr>
<td>Student Registration</td>
</tr>
<tr>
<td><table border="0" width="500">
<tr>
<td><fieldset><legend>Student Particulars</legend>
<table width="500" border="1">
<tr>
<td>Name:</td>
<td><input type="text" name="textfield"></td>
</tr>
<tr>
<td>NRIC/Birth Cert: </td>
<td><input type="text" name="textfield"></td>
</tr>
<tr>
<td> Nationality:</td>
<td><input type="text" name="textfield"></td>
</tr>
<tr>
<td>Address:</td>
<td><textarea name="textarea"></textarea></td>
</tr>
<tr>
<td>Gender:</td>
<td><input name="textfield" type="text" size="10" maxlength="1"></td>
</tr>
<tr>
<td>Residential Number: </td>
<td><input name="textfield" type="text" maxlength="8"></td>
</tr>
<tr>
<td>Handphone Number:</td>
<td><input name="textfield" type="text" maxlength="8"></td>
</tr>
</table>
</fieldset>*</p></td>
<td><fieldset><legend>In Case Of Emergency </legend>
<table width="500" border="1">
<tr>
<td>Name:</td>
<td><input type="text" name="textfield"></td>
</tr>
<tr>
<td>Contact Number : </td>
<td><input type="text" name="textfield"></td>
</tr>
</table>
</fieldset>
<fieldset><legend>Class Particulars </legend>
<table width="500" border="1">
<tr>
<td>Course:</td>
<td colspan="2"><select name="select">
</select></td>
</tr>
<tr>
<td>Grade:</td>
<td colspan="2"><select name="select">
</select>
</td>
</tr>
<tr>
<td>Available Timeslot: </td>
<td><input type=text name='p_name' readonly>
<a href="javascript:void(0);" NAME="My Window Name" title=" My title here "
onClick="window.open('chooseTime.php')";>Click here to choose a time slot</a>
</td>
</tr>
<tr>
<td>Commencement Date: </td>
<td colspan="2">Day:
<select name="select">
</select>
Month:
<select name="select">
</select>
Year:
<select name="select">
</select>
</td>
</tr>
<tr>
<td>Promotion Date:</td>
<td colspan="2">Day:
<select name="select">
</select>
Month:
<select name="select">
</select>
Year:
<select name="select">
</select></td>
</tr>
<tr>
<td>Rejoin Date:</td>
<td colspan="2">Day:
<select name="select">
</select>
Month:
<select name="select">
</select>
Year:
<select name="select">
</select></td>
</tr>
</table>
</fieldset>
</td>
</tr>
<tr>
<td colspan="2"><fieldset>
<legend>Staff Attended </legend>
<table width="500" border="1">
<tr>
<td>Name:</td>
<td><input type="text" name="textfield"></td>
</tr>
</table>
</fieldset></td>
</tr>
</table></td>
</tr>
</table>
</form>
</body>
</html>
Popup child php file: chooseTime.php
Code:
<?php require_once('Connections/MusicActConn.php'); ?>
<?php
$maxRows_Recordset1 = 10;
$pageNum_Recordset1 = 0;
$teacher = "";
$day = "";
$sTime="";
$eTime="";
$details = "";
if (isset($_GET['pageNum_Recordset1'])) {
$pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
}
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;
mysql_select_db($database_MusicActConn, $MusicActConn);
$query_Recordset1 = "SELECT teacherprofile.TeacherName, timeslot.LessonDay, timeslot.LessonStart, timeslot.LessonEnd FROM teacherprofile, timeslot WHERE teacherprofile.TeacherID = timeslot.TeacherID";
$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
$Recordset1 = mysql_query($query_limit_Recordset1, $MusicActConn) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
if (isset($_GET['totalRows_Recordset1'])) {
$totalRows_Recordset1 = $_GET['totalRows_Recordset1'];
} else {
$all_Recordset1 = mysql_query($query_Recordset1);
$totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
}
$totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="javascript">
function post_value(){
opener.document.f1.p_name.value = document.frm.c_name.value;
self.close();
}
</script>
<title>Time Slot</title>
</head>
<body>
<form name="frm" method="post">
<table width="100%" border="1">
<tr>
<td>Teacher Name </td>
<td>Lesson Day </td>
<td>Lesson Start Time </td>
<td>Lesson End Time </td>
<td> </td>
</tr>
<?php do {
$teacher = $row_Recordset1['TeacherName'];
$day = $row_Recordset1['LessonDay'];
$sTime = $row_Recordset1['LessonStart'];
$eTime = $row_Recordset1['LessonEnd'];
$details = $teacher." ".$day." ".$sTime." ".$eTime;?>
<tr>
<td><?php echo $teacher; ?></td>
<td><?php echo $day; ?></td>
<td><?php echo $sTime; ?></td>
<td><?php echo $eTime; ?></td>
<td> <input type="text" name="c_name" value="<?php echo $details;?>"> <input type="button" value="Choose" onclick="post_value();"> </td>
</tr>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
</table>
</form>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>