Jump to content

Help with carrying variables over to another page


bboundy

Recommended Posts

Hi

I have been having problems with a page that pulls data from a mysql database, then allows a user to fill in extra data. The whole lot must then be carried over to the same page using a switching variable (here called $export), where it will be placed in a tab delimited file and saved. The problem I have been having is that the page will not carry over the variables, and I am reluctant to use a html form, as I cannot have multiple results like the mysql_fetch_array function can (expecting >10 results).

 

if (!isset($export)){
?>


<?
//Head section of page table
echo "
<html><body><div align=\"center\">

<table width=\"650\" border=\"0\">

<tr>

<td width=\"50\" align=\"center\"><font face=\"verdana\" size=\"1\"><b>Teacher</b></font></td>
<td width=\"200\" align=\"center\"><font face=\"verdana\" size=\"1\"><b>Student</b></font></td>
<td width=\"125\" align=\"center\"><font face=\"verdana\" size=\"1\"><b>Date</b></font></td>	
<td width=\"150\" align=\"center\"><font face=\"verdana\" size=\"1\"><b>House</b></font></td>
<td width=\"75\" align=\"center\"><font face=\"verdana\" size=\"1\"><b>Year</b></font></td>
<td width=\"75\" align=\"center\"><font face=\"verdana\" size=\"1\"><b>Absence Type</b></font></td>	
<td width=\"75\" align=\"center\"><font face=\"verdana\" size=\"1\"><b>Reason</b></font></td>	
</tr>";

//check connection to database
//include ("./lib/mainlib.php");
include ("./inc/header.php");
db_connect();

$d_display = mysql_query("select a.sid as sid, t.init as init,
concat_ws(\", \",upper(s.lname), s.fname) as name,
date_format(from_unixtime(a.recabdate),'%d/%m/%Y') as date, 
s.house as house, s.year as year from 
absent a,  students s, teachers t
where a.sid = s.id and
       a.tid = t.id
       order by date desc");
      
while ($row = mysql_fetch_array($d_display))
{
$sid = $row["sid"];
$init = $row["init"];
$name = $row["name"];
$date = $row["date"];
$devhouse = $row["house"];
$devyear = $row["year"];

//This section displays results of sql, as well as different variables to be filled in

echo ("

<tr>

<td width=\"50\" align=\"center\"><font face=\"verdana\" size=\"1\">$init</font></td>
<td width=\"200\" align=\"center\"><font face=\"verdana\" size=\"1\">$name</font></td>
<td width=\"125\" align=\"center\"><font face=\"verdana\" size=\"1\">$date</font></td>
<td width=\"150\" align=\"center\"><font face=\"verdana\" size=\"1\">$devhouse</font></td>
<td width=\"75\" align=\"center\"><font face=\"verdana\" size=\"1\">$devyear</font></td>
<td width=\"75\" align=\"center\"><font face=\"verdana\" size=\"1\">
<select name=\"abtype\">
  <option value=\"Leave\">Leave</option>
  <option value=\"Exchange\">Exchange</option>
  <option value=\"Excursion\">Excursion</option>
  <option value=\"Full Day\">Full Day</option>
  <option value=\"Late\">Late</option>
  </select>
</font></td>
<td width=\"75\" align=\"center\"><font face=\"verdana\" size=\"1\">
<input name=\"abreason\" type=\"text\"> </font></td>

</tr>");

}

?>

<a href="<this page>?export=1">Dump Page</a>
<?
echo "</table></div></body></html>";
}

else{

//export function goes here
}

 

Any help with getting the variables to carry over would be greatly appreciated.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.