Needs Help in PHP and Javascript - Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more
Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more
Go Back   Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more > Webmaster Tech > Programming > PHP Development

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 12-11-2008, 07:25 AM   #1 (permalink)
Junior Member
 
Join Date: Dec 2008
Posts: 3
Exclamation Needs Help in PHP and Javascript

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>&nbsp;</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);
?>
Ayaka is offline   Reply With Quote
Sponsored Links
Old 12-12-2008, 12:24 AM   #2 (permalink)
Junior Member
 
Join Date: Dec 2008
Posts: 24
Default Re: Needs Help in PHP and Javascript

that does not turn out?
mysql installing on web server?
Streetwalker is offline   Reply With Quote
Old 12-13-2008, 07:55 PM   #3 (permalink)
Junior Member
 
Join Date: Dec 2008
Posts: 3
Default Re: Needs Help in PHP and Javascript

yup, it shows undefined in parent window. yup, mysql is on web server.
Ayaka is offline   Reply With Quote
Old 12-17-2008, 01:36 AM   #4 (permalink)
Junior Member
 
Join Date: Dec 2008
Posts: 3
Exclamation Re: Needs Help in PHP and Javascript

The error is that it shows "undefined" in the parent window. I want it to show the correct $details.. I don't really know why it can't work when it is in looping through the database. The code only works when it is outside the loop..
Ayaka is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Sponsors

» Links

» Affiliates
Web Hosting
Online Backup Reviews
Marketing Find
Merchant Select
SiteMap Builder
Host Compare

» Links

» Sports Network
Paintball Forum
Football Forum
Hockey Forum
Golf Forum
Boxing Forum
Lacrosse Forum
Baseball Forum
SnowBoarding Forum
Soccer Forum
MMA Forum


All times are GMT -4. The time now is 07:32 PM.


Powered by vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.2
Webmaster Forums
Web Hosting | Chicago Web Hosting | Web Hosting