Hello,
I have prepared a form and it is in its final stage. One thing that remains is the following: when I click a submit button in the page, all the information in the page, from different forms, needs to be collected and entered into a table.
I have created a new form with a button and once I click that button, it calls a new php (closeBill.php) file. I had planned that in this php file I would collect data from the page and just update the required table. But I am faced with the problem of not being able to access the values in the fields in the first file. If my explanation does not make sense please look at the following codes that I have included, may be it will make my problem apparent.
This is a part of the code from the page that contains the data:
[php]
.
.
.
<FORM NAME='topButton 3' METHOD='post' ACTION='closeBi ll.php'>
// this is the submit button in question
<td width="25%"><in put type="submit" value="Close Bill" name="clob">
</td>
</FORM>
</tr>
</table>
<!--nested table 2-->
<table border="1" bordercolor="" width="100%" bgcolor="">
<FORM NAME='waiterLog ' id = 'waiterLog' METHOD='POST' ACTION='waiterL og.php'>
<!--row 2-->
<tr>
<td width = "80" align = "right" >Waiter</td>
<td width = "10"></td>
<td width = "50">
//i amtrying to get this value into a variable after submitting the form
<select id = "loggedWait ers" name="loggedWai ters">
<option value='0'>logge d waiters</option>
<?php
$loggedWaiterTa ble_sql = "SELECT * FROM LoggedWaiterNam e";
$loggedWaiterTa ble_result = mysql_query($lo ggedWaiterTable _sql, $db);
$counter = 1;
while ($row = mysql_fetch_ass oc($loggedWaite rTable_result)) {
$waiterID = $row['waiterID'];
echo "<option value='$waiterI D'>" . $waiterID . "</option>\n\t";
$counter++;
}
?>
</select></td>
</td>
</FORM>[/php]
Once the closeBill button is clicked, it goes to this field:
[php]<?php
include("db_con nect.php");
//this is the part that does not work
$waiter_Email = $_POST['waiterLog.logg edWaiters'];
if($waiter_Emai l != NULL)
echo $waiter_Email;
else echo "no data"; //this is what prints out
//this part works fine
$closeBill2_sql = "TRUNCATE TABLE BillSpreadsheet ";
mysql_query($cl oseBill2_sql, $db);
include("ssa.ph p");
?>
[/php]
I have prepared a form and it is in its final stage. One thing that remains is the following: when I click a submit button in the page, all the information in the page, from different forms, needs to be collected and entered into a table.
I have created a new form with a button and once I click that button, it calls a new php (closeBill.php) file. I had planned that in this php file I would collect data from the page and just update the required table. But I am faced with the problem of not being able to access the values in the fields in the first file. If my explanation does not make sense please look at the following codes that I have included, may be it will make my problem apparent.
This is a part of the code from the page that contains the data:
[php]
.
.
.
<FORM NAME='topButton 3' METHOD='post' ACTION='closeBi ll.php'>
// this is the submit button in question
<td width="25%"><in put type="submit" value="Close Bill" name="clob">
</td>
</FORM>
</tr>
</table>
<!--nested table 2-->
<table border="1" bordercolor="" width="100%" bgcolor="">
<FORM NAME='waiterLog ' id = 'waiterLog' METHOD='POST' ACTION='waiterL og.php'>
<!--row 2-->
<tr>
<td width = "80" align = "right" >Waiter</td>
<td width = "10"></td>
<td width = "50">
//i amtrying to get this value into a variable after submitting the form
<select id = "loggedWait ers" name="loggedWai ters">
<option value='0'>logge d waiters</option>
<?php
$loggedWaiterTa ble_sql = "SELECT * FROM LoggedWaiterNam e";
$loggedWaiterTa ble_result = mysql_query($lo ggedWaiterTable _sql, $db);
$counter = 1;
while ($row = mysql_fetch_ass oc($loggedWaite rTable_result)) {
$waiterID = $row['waiterID'];
echo "<option value='$waiterI D'>" . $waiterID . "</option>\n\t";
$counter++;
}
?>
</select></td>
</td>
</FORM>[/php]
Once the closeBill button is clicked, it goes to this field:
[php]<?php
include("db_con nect.php");
//this is the part that does not work
$waiter_Email = $_POST['waiterLog.logg edWaiters'];
if($waiter_Emai l != NULL)
echo $waiter_Email;
else echo "no data"; //this is what prints out
//this part works fine
$closeBill2_sql = "TRUNCATE TABLE BillSpreadsheet ";
mysql_query($cl oseBill2_sql, $db);
include("ssa.ph p");
?>
[/php]
Comment