I am having trouble getting the correct name for the input boxes from the code below :
include("db.php");
if ($page=='2')
{
if ($store=='yes')
{
if ($what=='caps')
{
$what="$room_name theatre";
print("$roomselect $what");
}
if ($what=='dimensions')
{
print("$roomselect $what $store");
}
if ($what=='heights')
{
print("$roomselect $what $store");
}
}
$query="SELECT room_name,theatre,u_shape,hollow_square,classroom,boardroom,cabaret,reception,dinner_dance,banquet FROM conf_rooms WHERE hotel_id='$hotel'";
$result=do_query($query);
print("<html><head><title>List Conference Rooms for hotel</title>
<link rel=\"stylesheet\" href=\"../../ccs.css\" type=\"text/css\">
<script language=\"Javascript1.2\">
<!--
function goNow(target)
{
if (target==1){
document.form1.action=\"chngrooms.php?page=2&store=yes&what=caps\";
document.form1.submit();
}
if (target==2){
document.form2.action=\"chngrooms.php?page=2&store=yes&what=dimensions\";
document.form2.submit();
}
if (target==3){
document.form3.action=\"chngrooms.php?page=2&store=yes&what=heights\";
document.form3.submit();
}
}
function room(roomname,targ)
{
if (targ==1) document.form1.room_name.value=roomname;
if (targ==2) document.form2.roomselect.value=roomname;
if (targ==3) document.form3.roomselect.value=roomname;
}
function check()
{
var sure= confirm(\"Do you really want to update figures ?\");
if (sure== true)
{
return true;
}
else return false
}
// -->
</script>
</head>
<body class=body>
<p /><p />
<table width=100% border=1 bordercolor=white class=table><form name=form1 method=post>
<td>Room Name</td>
<td align=center>Theatre</td>
<td align=center>U Shape</td>
<td align=center>Square</td>
<td align=center>Classroom</td>
<td align=center>Boardroom</td>
<td align=center>Cabaret</td>
<td align=center>Reception</td>
<td align=center>Dinner Dance</td>
<td align=center>Banquet</td>");
while(list($room_name, $theatre, $u_shape, $hollow_square, $classroom, $boardroom, $cabaret, $reception, $dinner_dance, $banquet)=mssql_fetch_row($result))
{
print("
<tr><td width=5%><a href=\"javascript:goNow(1);\" onclick=\"room('$room_name','1');\">$room_name</a></td>
<td align=center><input type=text name=\"$room_name theatre\" size=3 maxlength=10 class=lighttextbox value=$theatre></td>
<td align=center><input type=text name=\"u_shape.$room_name\" size=3 maxlength=10 class=lighttextbox value=$u_shape></td>
<td align=center><input type=text name=\"hollow_square.$room_name\" size=3 maxlength=10 class=lighttextbox value=$hollow_square></td>
<td align=center><input type=text name=\"classroom.$room_name\" size=3 maxlength=10 class=lighttextbox value=$classroom></td>
<td align=center><input type=text name=\"boardroom.$room_name\" size=3 maxlength=10 class=lighttextbox value=$boardroom></td>
<td align=center><input type=text name=\"cabaret.$room_name\" size=3 maxlength=10 class=lighttextbox value=$cabaret></td>
<td align=center><input type=text name=\"reception.$room_name\" size=3 maxlength=10 class=lighttextbox value=$reception></td>
<td align=center><input type=text name=\"dinner_dance.$room_name\" size=3 maxlength=10 class=lighttextbox value=$dinner_dance></td>
<td align=center><input type=text name=\"banquet.$room_name\" size=3 maxlength=10 class=lighttextbox value=$banquet></td></tr>");
}
print("<input type=hidden name=room_name></table></form><input type=submit name=submit value=\"Update Figures\" class=buttons><p /><p />
Everything works out fine with the names being propogated from the room names from the database. When you click the link (the room name) and get passed to the second form, I can't get the details of the input boxes as I can't get the input names to come through. And when I do, then nothing happens. All it does is literally print the roomname and the work theatre. Not the value that was on the form.
Any help ?