I have 2 forms on one page. I have hidden variables in each form, with separate names, that contain values. The user decides which form to submit on. Only 1 form will be processed.
Now my problem is, when I read the Post Variables from the server side with PHP. -
-
foreach($_POST as $name => $value) {
-
print "$name : $value<br>";
-
}
-
That code will output the hidden variables from both forms, rather than just the form the user submitted on respectively. -
<form name = 'form0' method = 'POST' action='add.php'>
-
<input type = 'hidden' name='hItem0' value = 'test0'>;
-
<input type = 'submit' value = 'Add0'>
-
</form>
-
-
<form name = 'form1' method = 'POST' action='add.php'>
-
<input type = 'hidden' name='hItem1' value = 'test1'>;
-
<input type = 'submit' value = 'Add1'>
-
</form>
-
The output on add.php is test0 and test1, despite which form the user submitted on.
Someone care to shed some light?
4 5217
The html is correct, and functions correctly, so I can only assume there is something wrong on the PHP side. You need to ask on that board.
Well the PHP side is the server side. There can't be anything wrong there because the HTML submits the post variables to the PHP side.
The PHP side doesn't create post variables...so they are obviously getting sent over.
Well you are correct about the HTML being right. I stupidly, forgot to close the tag on the form. I put </form rather than </form>. I typed it correctly, of course, above.
It amazes me how many problems I run into due to stupid mistakes like this lol. I always look for a logical answer as to why something isn't work but it always winds up being the most unexpected mistake.
Thanks for your help.
Don't forget. I am never, ever, ever wrong.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Marcus |
last post by:
Hi All,
I was wondering if there is a way to ensure that when submitting forms
and using POST vars, the page sending the form resides on the same
server as the destination page specified in the form action.
For example, if I have a page on a live server that accepts POST
variables, I can simply create a second page on my local host or any
other server for that matter that lets me send any values I want for
these POST variables.
|
by: sarah |
last post by:
Hi.. I'm having a problem trying to figure out the best way to
process a POST and add items to my database, and hope someone can help
me... :)
Background:
I have a database that I will use to hold Purchases of Items
Each Item purchased is stored in it's own record:
....etc...
|
by: Paul |
last post by:
Title: What are the Consequences of Aspx page separate from app DLL
Hi JL;
I am working on a big asp.net application.
When we migrate the dll (or dlls) to the production server, all users
who are login into the application are pumped off. In fact we must
close down the server (to preserve users from being logged on and
thinking they are updating data when it is in fact lost when we move
the dlls to the the applications bin directory)....
|
by: Kit |
last post by:
Hi there,
I am recoding a website, and I want to add a generic footer to each
page, using an included file with PHP snippets. Part of that footer
would be a link to validate the page using the W3C's validation
service. The code currently looks like this:
<code>
<a href="http://validator.w3.org/check?uri=<?php echo
"http://www.athenatest.org" . $PHP_SELF; ?>" >
|
by: Deb M. |
last post by:
I am trying to find out how I can use the ASP.net framework yet still
post the variables to an external script (not ASPX) after the form has
been submitted. So, the ASPX page will still post to itself, but then
I need to transfer the variables to another page. I need to do this
transfer using the POST method and not the GET method.
I tried user Server.Transfer("http://localhost/test.asp") but it
retuns an error of...
| |
by: Lars Netzel |
last post by:
Hello!
I have a button, in the click event I have this code:
----------------------------------------------------------------------------
----------------------------
Response.Write("<script
language=javascript>window.open('CrystalReports.aspx?FromDate=" &
txtFromDate.Text & "&ToDate=" & txtToDate.Text & "&File=" &
drpReports.SelectedValue & "');</script>")
|
by: WhatsPHP |
last post by:
Hi
For some reason, at random posts, the post variables don't get thru to
the server. For example, if there is are two text fields: name and
email... (I have register_globals on)... When I try to update the
database with a query and use $name, $email, the $name is missing or
the $email is missing. I am building an intranet application and all
the 20 or so clients run IE. This happens very rarely. Something like
once in 100 updates.
|
by: Vic Spainhower |
last post by:
Hello,
I have an HTML table that is being constructed from a MySQL table and
displays a form that includes a check box on 1 of the fields on the form for
each record. I have included in this PHP program a javascript routine called
sorttable.js which is something I found on the internet for sorting tables
and works quite well. The HTML table includes a check box on each record so
the user can select certain records for passing to the...
|
by: Aaron |
last post by:
I'm trying to pull data from a website and read it into a file the I
can parse. I've done the before to site without post variables but I
can seem to get my statments to work with the post. Can someone help
me out?
below is the code I have so far. Thank in advance...
$url="www.somesitethatneedspostvariables.com";
$postdata = http_build_query(
array( 'postvarname1' ='value1',
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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...
|
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();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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
| |