473,698 Members | 2,023 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

getting data from multiple forms

10 New Member
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]
Dec 3 '06 #1
2 3823
ronverdonk
4,258 Recognized Expert Specialist
Without looking too deep, the following springs up
[php]$waiter_Email = $_POST['waiterLog.logg edWaiters'];[/php]
The fields are posted by name, so this statement should be:
[php]$waiter_Email = $_POST['loggedWaiters'];
[/php]

Ronald :cool:
Dec 3 '06 #2
seangates
19 New Member
goresus,

You have to put the forms together. Whatever form you submit gets submitted. So, when you click the submit button for the first form (topButton3), you don't get anything because there are no other fields besides the button itself.

So, you need to combine them, kinda like this:
[php]
<FORM NAME='topButton 3' METHOD='post' ACTION='closeBi ll.php'>
<td width="25%"><in put type="submit" value="Close Bill" name="clob">
</td>
</tr>
</table>
<!--nested table 2-->
<table border="1" bordercolor="" width="100%" bgcolor="">
<!--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]
Now, that convention is not valid HTML because the <form> tags should really wrap around the <table> tags, and not inside them anywhere.

Hope this helps.
Sean
Dec 4 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
1726
by: spiderman | last post by:
Hi, How can I getting parameter values from more than 1 HTML form onto the same ASP page? Thank you
2
4406
by: Logical | last post by:
I have a form which houses basic inputs, as well as a few multiple select forms. I need to parse all the 'values' which are in this multiple select form (it gets manipulated dynamically client side). I wanted to create a function that loops through all the form elements, and if the type 'select-multiple' is detected, gather the VALUES of each <option> inside it. The bit I'm stuck on is then how to reconstruct this into a form...
4
1929
by: Bill Stock | last post by:
The few times in the past that I've loaded unbound data, I've tended to cheat and use temp tables (not really unbound) or use code for small datasets. I'm currently involved in a project that has numerous tables in the 200 column range, with several thousand rows of data. A consulting review prior to my involvement stressed the wasted space and database speed as the major impetus for normalization. Although the db actually works fairly...
2
301
by: Mervin Williams | last post by:
I am using Infragistics UltraWebTab (a tab folder control for ASP.NET). My tab folder control will include five tab pages with a separate web form on each, and these web forms will share data. My questions regard the data tier, that is, how I should construct the data objects so as to reduce memory usage while optimizing page performance? 1. I'll be using data sets. How can I share a single data set across the multiple web forms? 2....
10
1723
by: darrel | last post by:
I have this structure: mypage.aspx (class = mypage) myusercontro.ascx On the mypage.aspx I can declare a variable: animal = "monkey" I can read this from the UC by simply doing this: mypage.animal
3
2086
by: Saket Mundra | last post by:
I have multiple web forms in my application. The user after logging on is directed to form1 where he enters information desired. Once finished he is directed to form2 and the same procedure goes on till form6. After user has entered information in all 6 forms the information needs to be entered in the database by performing a Transaction. If the data from any of the forms is missing the Transaction is rolled back. My query is where do i...
4
8503
by: Joe Schmoe | last post by:
All I want to to be able to take a two-column DataReader (One column with the Item ID number, the other with Item Description text) and load it into a Windows Forms ComboBox (Set to DropDownList mode) so that I the dropdown shows the Item Descriptions, but returns the Item ID number when selected. Completely easy in ASP.NET, but I cannot figure out how to do the same in a Windows Forms app. Obviously the Windows Forms ComboBox is a lot more...
3
3128
by: blue875 | last post by:
Ok, I've tried searching, and haven't found the answer, so it must mean everyone else but me already knows this. I have an Access 2000 form that I want to connect to an Access 2000 table in the same database. What I am able to do is create a connection string, explicitly giving my admin-level userId and password, and it works. But when I try to create a connection string that doesn't use this explicit definition, I get permission issues,...
9
2183
by: karenjfrancis | last post by:
I have 4 Access databases, all with the same data model but different data. I want to build a front end that brings all of the data in the 4 databases together into one. Assuming my table of interest is called Removals, if I create linked tables I end up with Removals1, Removals2, Removals3 and Removals4. I could easily write a query to base a form or report upon to concatenate all of these tables' data into one view. However, the...
0
9157
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9027
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8895
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6518
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5860
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4369
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3046
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.