473,322 Members | 1,714 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,322 software developers and data experts.

Help with posting form fields



I have a form like the one below. Upon submit I would like to self post
to the same page but have the original $_POST data( which was posted to
this page from another ) also be sent along with the new form field
data. How can I achieve that? Thanks.
<form name="form1" method="post" action="<?php echo
$_SERVER['PHP_SELF']."?".$_SERVER['QUERY_STRING']; ?>">
<table>
<tr>
<th><input type="text" name="fields[]"</th>
....
<th><input type="text" name="fields[]"</th>
<th><input type="submit" value="Add" name="add"</th>
</tr>
</table>
</form>
Apr 19 '06 #1
4 1384
mickey wrote:
I have a form like the one below. Upon submit I would like to self post
to the same page but have the original $_POST data( which was posted to
this page from another ) also be sent along with the new form field
data. How can I achieve that? Thanks.
You could use hidden fields to pass the data


<form name="form1" method="post" action="<?php echo
$_SERVER['PHP_SELF']."?".$_SERVER['QUERY_STRING']; ?>">
<table>
<tr>
<th><input type="text" name="fields[]"</th>
...
<th><input type="text" name="fields[]"</th>
<?php
foreach($_POST as $k => $v)
echo '<input type="hidden" name="' . $k . '" value="' .
stripslashes($v) . '">';
?>
<th><input type="submit" value="Add" name="add"</th>
</tr>
</table>
</form>


Ken

Apr 19 '06 #2
"mickey" <mi**************************@ignore.this> wrote in message
news:cB*******************@bignews5.bellsouth.net. ..


I have a form like the one below. Upon submit I would like to self post to
the same page but have the original $_POST data( which was posted to this
page from another ) also be sent along with the new form field data. How
can I achieve that? Thanks.
<form name="form1" method="post" action="<?php echo
$_SERVER['PHP_SELF']."?".$_SERVER['QUERY_STRING']; ?>"> <table> <tr>
<th><input type="text" name="fields[]"</th>
...
<th><input type="text" name="fields[]"</th>
<th><input type="submit" value="Add" name="add"</th>
</tr>
</table> </form>

You could save the values in a cookie, and retrieve them on the next page
load (see the setcookie function).

Alternatively, you could add them to the next form as hidden fields, so they
are passed along with the current values on the next form post.
Apr 19 '06 #3

Works beautifully, thank you!

Ken Robinson wrote:
mickey wrote:
I have a form like the one below. Upon submit I would like to self post
to the same page but have the original $_POST data( which was posted to
this page from another ) also be sent along with the new form field
data. How can I achieve that? Thanks.


You could use hidden fields to pass the data

<form name="form1" method="post" action="<?php echo
$_SERVER['PHP_SELF']."?".$_SERVER['QUERY_STRING']; ?>">
<table>
<tr>
<th><input type="text" name="fields[]"</th>
...
<th><input type="text" name="fields[]"</th>


<?php
foreach($_POST as $k => $v)
echo '<input type="hidden" name="' . $k . '" value="' .
stripslashes($v) . '">';
?>
<th><input type="submit" value="Add" name="add"</th>
</tr>
</table>
</form>


Ken

Apr 19 '06 #4
I tried the hidden approach and it worked, thank you.

Bruno wrote:
"mickey" <mi**************************@ignore.this> wrote in message
news:cB*******************@bignews5.bellsouth.net. ..

I have a form like the one below. Upon submit I would like to self post to
the same page but have the original $_POST data( which was posted to this
page from another ) also be sent along with the new form field data. How
can I achieve that? Thanks.
<form name="form1" method="post" action="<?php echo
$_SERVER['PHP_SELF']."?".$_SERVER['QUERY_STRING']; ?>"> <table> <tr>
<th><input type="text" name="fields[]"</th>
...
<th><input type="text" name="fields[]"</th>
<th><input type="submit" value="Add" name="add"</th>
</tr>
</table> </form>

You could save the values in a cookie, and retrieve them on the next page
load (see the setcookie function).

Alternatively, you could add them to the next form as hidden fields, so they
are passed along with the current values on the next form post.

Apr 19 '06 #5

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

Similar topics

9
by: Don Seckler | last post by:
I am trying to set up a PHP web page so I can enter data into a database. I created a form: <form action="admin_news_insert_processor.php" method="post" name="frm_Insert_News"...
1
by: PT | last post by:
I got a problem. And thats..... First of all, I got these three tables. ------------------- ------------------ ---------------------- tblPerson tblPersonSoftware ...
2
by: qsweetbee | last post by:
I have a form(fAddUsers) in my database. It is continue form for data entry. Some fields are required fields. Some are optional fields. There is 1 particular filed(TokenExpirationDate)on the form...
9
by: Dom Boyce | last post by:
Hi First up, I am using MS Access 2002. I have a database which records analyst rating changes for a list of companies on a daily basis. Unfortunately, the database has been set up (by my...
9
by: Edward S | last post by:
I budget for a Project in an Excel sheet as illustrated below. The months below are usually a 2 year period i.e. 24 months, though it could be over 24 months depending upon a Project. I then...
20
by: Jack Schitt | last post by:
I thought I was starting to get a handle on Access, until I tried doing something useful...now I'm stuck. I have a DB with two tables - to keep it simple I'll say that one is an Employee File...
8
by: newbie | last post by:
hello How can I update more than one tables on the same form? The relationship is one to many from a master table to 3 other related tables. on the form, I have to setvalue for a few...
2
by: Chris Millar | last post by:
Can anyone help me on converting this vb asp page to C#, thanks in advance. chris. <!DOCTYPE HTML PUBLIC "-//W3C//Dtd HTML 4.0 transitional//EN"> <%...
0
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted...
47
by: Jo | last post by:
Hi there, I'm Jo and it's the first time I've posted here. I'm in process of creating a database at work and have come a little unstuck.....I'm a bit of a novice and wondered if anyone could...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.