473,405 Members | 2,141 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

How to combine and pass data in one page?

I didn't know what to use as a title for this. Here is the scenario:

I have a op.reqedit.php page. This page a form where you input data.
In this page I have split a MySQL field. It is called
MachineTypeOfWork and is split into Replace, Adjusted, REbuild,
Inspected and Repair. These all become check boxes for the user. The
form submits to op.reqadd.php. In this page I first have a hidden box
where I combine all of the above into Type (this works fine, I have
unhidden the box to see it). Then I have

$MachineTypeofWork = $_GET['Type'];
$sql_query = mysql_query("UPDATE results SET (a bunch of fields)
MachineTypeOfWork='$MachineTypeofWork' WHERE WorkOrder = '$wo'") or die
(mysql_error());

My problem is that it updates all of the fields it should except the
MachineTypeOfWork field in MySQL. It actually overwrites what is
already there with nothing.

What I do not know (I am new) is can I combine the field and pass it to
the database in the same page or do I need another page in the
background for this?

ANy help is appreciated.

Tina

Jul 21 '05 #1
2 1818


ti*********@gmail.com wrote (in part):
I didn't know what to use as a title for this. Here is the scenario:

$MachineTypeofWork = $_GET['Type'];
What is the method that is used on your form? The above will be valid
if the method is "get", if it is "post" use $_POST['Type'] instead.
$sql_query = mysql_query("UPDATE results SET (a bunch of fields)
MachineTypeOfWork='$MachineTypeofWork' WHERE WorkOrder = '$wo'") or die
(mysql_error());


If you set a variable to the query string and then echo the string,
what is printed?

When your script start, dump the $_GET and $_POST superarrays and check
what your script is receiving.

<?
echo '<pre>';print_r($_POST);echo '</pre>';
echo '<pre>';print_r($_GET);echo '</pre>';
?>

Let us know the results.

Ken

Jul 21 '05 #2
I am using Get (and it works for all of the other fields. Here is what
I have in the beginning of my reqadd page to pull everything together.
It is unhidden now to make sure it works.

<?
$Replace = $_GET['Replace'];
$Adjusted = $_GET['Adjusted'];
$Rebuild = $_GET['Rebuild'];
$Inspected = $_GET['Inspected'];
$Repair = $_GET['Repair'];
?>
<html>
<INPUT NAME="Type" Value="<?if ($Replace !='Replace')print "0";else
echo $Replace;?>.<?if ($Adjusted != 'Adjusted')print "0";else echo
$Adjusted;?>.<?if ($Rebuild != 'Rebuild')print "0";else echo
$Rebuild;?>.<?if ($Inspected != 'Inspected')print "0";else echo
$Inspected;?>.<?if ($Repair !='Repair')print "0";else echo
$Repair;?>"></html>

<?
$MachineTypeOfWork = $_GET['Type'];

This prints out correctly, but now when I continue with anything. Even
Echo $MachineTypeOfWork it prints out nothing. When I run the script
you gave me I get

[wo] => 2
[MachineAssignedTo] => adfweg
[MachineDateAssigned] => 07/20/05
[MachineDateDue] => werf
[MachineDateCompleted] => aewrv
[MachineFollowUp] =>
[Replace] => Replace
[Adjusted] => Adjusted
[Rebuild] => Rebuild
[Inspected] => Inspected
[Repair] => Repair
[MachineWorkDone] =>
[MachineMaterialsUsed] =>

This is correct, it's all coming across. With the code above it also
prints out correctly (Replace.Adjusted.Rebuild.Inspected.Repair), It's
just that from this point on I seem to not be able to convert it to the
MYSQL field that I need it to send to.

Jul 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

24
by: trint | last post by:
add them into one PrintDocument: PrintDocument pd1 = new PrintDocument(); PrintDocument pd2 = new PrintDocument(); PrintDocument pdCombined = new PrintDocument(); pdCombined = pd1 + pd2;...
3
by: Chris | last post by:
I have a modal (yes it must be modal) web page. I do this by having an empty frame that points to my main page (so that I can repost without new popups) I have to pass data to the child page from...
8
by: darrel | last post by:
I'm still trying to fully understand how best to pass variables between pages/usercontrols/each other. On a current site I've done, I've had one userControl do the logic and set the variable,...
8
by: frekster | last post by:
Hi. I used to be able to do this easily in vb 6 via looping and preserving the source array data/size etc. How can I do this in vb.net? I've been trying for a while now and this should be...
17
by: Rabbit | last post by:
Hi, On my 1st page, i have a function which gets a new ID value and need to transfer to another immediately. which I want to get in 2nd page using Request.form("txtID"), but doesn't work, the...
1
by: zwieback89 | last post by:
Hi, I am still not able to get this working in a simple page. Please help me. I am badly stuck.... I am trying to view the contents of the Beverage Category. I have built it like a hierarchy...
5
by: Rodjk #613 | last post by:
Hello, I am working with a database that is in use in several locations. The structure of the databases are identical, but the data is different. I am tasked with combining the data into one...
3
beacon
by: beacon | last post by:
Hi everybody, I have a data access page and I would like to modify the navigation buttons, if possible. I want to combine the MSONavAddNew button with the MSONavSave button so that when the...
9
by: JRough | last post by:
I tried to pass the $result from a mysql_query in a url like this line Header("Location:clm_historyXL.php?_result=".$result); but on the redirect location clm_history.php page I get an error on...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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,...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...

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.