pancgom 0 Light Poster

Hi,

I have this page which has 2 fields name of the referee then the email address of the referee , this will be the first set of information. Then when the user click the add reference button there has to be another set of fields similar to the one on top for the next set of references.

I have posted a similar request earlier but i just could not figure out how this is done. Can anyone help me with the code please.

Thanks.

<?php
include 'init.php';

if (!is_authed())
{
        header("Location: xxxxxxxxx/login.php?fail=3");
        exit;
}
$ID = $_SESSION['ID'];

$results = mysql_query("SELECT * FROM `References` WHERE ID=$ID");
$row = mysql_num_rows($results);
if($row == 0)
{
        mysql_query("INSERT INTO `References` (ID) VALUES ('$ID')");
}

if($_POST['save'] || $_POST['next'])
{
$NameOfReferee = $_POST['NameOfReferee'];
$EmailAddress = $_POST['EmailAddress'];

$query = "UPDATE `References` SET NameOfReferee='$NameOfReferee', EmailAddress='$EmailAddress' WHERE ID=$ID";
mysql_query($query);
}

if($_POST['next'])
{
        header("Location: xxxxxxxx/pg6.php");
        exit();
}

$query = "SELECT * FROM `References` WHERE ID=$ID";
$results = mysql_query($query);
$data = mysql_fetch_array($results);

$NameOfReferee = $data['NameOfReferee'];
$EmailAddress = $data['EmailAddress'];
?>




<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<TITLE>xxxxxxxxxxx</TITLE>

<link href="CSS/GraduateProgram.css" rel="stylesheet" type="text/css">


</head>


<body bgcolor="#FFFFFF" topmargin="0">



<table width=1000 align="center" border="0" cellspacing="0" cellpadding="0" bgcolor="#FF6600">
    <tr>
      <td bgcolor="#FFFFFF"><img src="images/xxxxxxx.png" alt="xxxxxxxxx" width="450" height="92"></td>
    </tr>
  </table>
  <br>
  <table width=1000 border="0" align="center" cellpadding="3" cellspacing="0" bgcolor=white style="border:1px solid #999999;" valign=top>
    <TR>
      <td height="30" colspan=3 align="left" valign="middle" bgcolor=#ff9933 class="BodyTextHeaders">Section VI - Academic References</td>
    </TR>
    <TR>
      <td colspan=3 align="left" valign="top" bgcolor=white class="BodyText">Application Number:</td>
    </TR>
    <TR>
      <td colspan=3 align="left" valign="top" bgcolor=white class="BodyText">Applicant Name :</td>
    </TR>
    <TR>
      <td colspan=3 align="left" valign="top" bgcolor=white class="BodyText"> Please note that only personal details can be amended.
        For amendments on other data, please contact the 
        administrator for assistance.</td>
    </TR>
    <TR>
      <td colspan=3 align="left" valign="top" bgcolor=white class="BodyText">Items indicated with an asterisk * are mandatory.</td>
    </TR>
</TABLE>
  <br>


<form action="<?php echo $_SERVER['PHP_SELF']?>" method="post" name="pg5.php"> 

<table  border=0 align="center" cellpadding = 3 cellspacing = 0  width="1000" style="border:1px solid #999999;">

  <tr>
    <td colspan=2 align="left" bgcolor=#E8E8E8 class="BodyText" >
       Please provide details of two academic referees and request them to submit
        their reports using the prescribed form (which will be made available for
        printing when you "submit" this online application). <br>    </td>
  </tr>
  <tr>
    <td height="30" colspan=2 align="left" bgcolor=#ff9933 class="BodyTextHeaders" >
      * Referee 1</td>
  </tr>
  <tr>
    <td align="left" valign="top" bgcolor=#E8E8E8 class="BodyText" >
      * Name of Referee :</td>
    <td width=63% align="left" bgcolor=#E8E8E8 class="BodyText" >
      <input name="NameOfReferee" type="text" class="BodyText"
					style="color: 000000 ; font-weight: bold; text-transform:mixedcase" value="<?=$NameOfReferee?>

" size="50" maxlength="50" id="NameOfReferee">    </td>
  </tr>
  <td width=37% align="left" valign="top" bgcolor=white class="BodyText" >
    * E-Mail Address :    </td>
<td align="left" bgcolor=white class="BodyText" >
        
      <input name="EmailAddress" type="text" class="BodyText"
					style="color: 000000 ; font-weight: bold; text-transform:mixedcase" value="<?=$EmailAddress?>

" size="50" maxlength="50" id="EmailAddress">    </td>


        <br>
        <br>
</table>

<br>
<table  border="0" align="center" cellpadding = "3" cellspacing = "0"  width="1000" style="border:1px solid #999999;">
  <tr>
    <td height="30" colspan="2" align="left" bgcolor="#ff9933" class="BodyTextHeaders" > *
      Referee 2</td>
  </tr>
  <tr>
    <td align="left" valign="top" bgcolor="#E8E8E8" class="BodyText" > * Name
      of Referee : </td>
    <td width="63%" align="left" bgcolor="#E8E8E8" class="BodyText" ><input name="" type="text" class="BodyText"
					style="color: 000000 ; font-weight: bold; text-transform:mixedcase" value="" size="50" maxlength="50" />
    </td>
  </tr>
  <tr>
    <td width="37%" align="left" valign="top" bgcolor="white" class="BodyText" > *
      E-Mail Address : </td>
    <td align="left" bgcolor="white" class="BodyText" ><input name="" type="text" class="BodyText"
					style="color: 000000 ; font-weight: bold; text-transform:mixedcase" value="" size="50" maxlength="50" />
    </td>
  </tr>
</table>
<br />
<div id="div"></div>

<table width="1000" align="center">
  <TR>
    <TD><div align="center">
      <input type="button" class="BodyText" onClick="generateRow()" value="Add Another Reference" />
    </div></TD>
  </TR>
</table>
<br>
 
<div class="BodyText" id="dynamicInput"></div>

<br>
<TABLE  border=0 ALIGN="center" cellpadding = 3 cellspacing = 0 width="1000" style="border:1px solid #999999;">
  <TR>
    <td height="30" align="left" valign="middle" bgcolor=#ff9933 class="BodyTextHeaders" >Important Notes</td>
  </TR>
  <TR>
    <td height="100" align="left" valign="middle" bgcolor=white ><ul>
      <li class="BodyText">If you have entered information in the above
        section, please click the "Save Changes" button. </li>
      <li class="BodyText"> If no information is updated, please click "Next Section" button. </li>
      <li class="BodyText">Clicking the "Main Menu" button will bring you
        back to the screen listing all sections.</li>
      <li><span class="BodyText">Please click the "Log Out" button to exit.</span><br>
      </li>
    </ul></td>
  </TR>
</TABLE>

<div align="center" >
  <p><br>
    <input name="next" type="submit" class="BodyText" value="Proceed to Next Section">
    <input name="save" type="submit" class="BodyText" value="Save Changes">
    <input name="reset" type="reset" class="BodyText" value="Clear Form">
    <input name="logout" type="submit" class="BodyText"  value="Logout">
  
</div>

</form>


</p>
  <p align="center">6/12<br>
  </p>

</BODY>
</HTML>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.