[Solved] Posting to multiple URLs through one form
Moderator: General Moderators
[Solved] Posting to multiple URLs through one form
Dear All
I have a data form. On this data form are a variety of text INPUT objects, as well as a few FILE objects.
Also on this page are 'Preview Post', 'Clear Form', 'Submit Form' and 'Upload Pictures' buttons, each of which need the information contained within the form.
However, using the ACTION parameter for the form, I can only stipulate one target URL for any submit buttons embedded in the form.
I want to be able to use the image buttons (Preview, Clear, Submit, Upload) described above to go to their corresponding URLs, but also for those URLs to receive the corresponding POST information from the data form.
Seeing as I can only use one URL through stipulating the ACTION parameter in the FORM, how can I post the information on the forms to each of those URLs separately?
I hope that's clear.
Many thanks
Mark
I have a data form. On this data form are a variety of text INPUT objects, as well as a few FILE objects.
Also on this page are 'Preview Post', 'Clear Form', 'Submit Form' and 'Upload Pictures' buttons, each of which need the information contained within the form.
However, using the ACTION parameter for the form, I can only stipulate one target URL for any submit buttons embedded in the form.
I want to be able to use the image buttons (Preview, Clear, Submit, Upload) described above to go to their corresponding URLs, but also for those URLs to receive the corresponding POST information from the data form.
Seeing as I can only use one URL through stipulating the ACTION parameter in the FORM, how can I post the information on the forms to each of those URLs separately?
I hope that's clear.
Many thanks
Mark
In case that isn't clear, maybe this will help:
I want to be able to POST the contents of those INPUT objects to either preview.php, clear.php, submit.php or upload.php, depending on the user's requirements. However, with only 1 URL able to be given for the form's ACTION parameter, and with the INPUT objects containing text too large to simply be transferred through the URL via the usual url.pjp?text=hello&text2=goodbye, how do I post the information to those different URLs depending on what button the user clicks on?
It seems quite a conundrum for quite a basic need.
Many thanks
Mark
Code: Select all
<FORM METHOD="post" ACTION="???.php">
<INPUT TYPE="text" LENGTH="3">
<INPUT TYPE="text" LENGTH="10">
<INPUT TYPE="file">
<A HREF="preview.php"><IMG SRC="preview.jpg"></A>
<A HREF="clear.php"><IMG SRC="clear.jpg"></A>
<A HREF="submit.php"><IMG SRC="submit.jpg"></A>
<A HREF="upload.php"><IMG SRC="upload.jpg"></A>
</FORM>It seems quite a conundrum for quite a basic need.
Many thanks
Mark
- Bill H
- DevNet Resident
- Posts: 1136
- Joined: Sat Jun 01, 2002 10:16 am
- Location: San Diego CA
- Contact:
You have posted three separate times on the same subject, which is not very polite. Nonetheless:
Item one. This creates a "submit" button using an image. A form may have as many as you like, each with a different "Name" property. Image can be a jpeg.
A click on that button/image will result in a POST var in the resolving form of Page1.x and Page1.y which PHP resolves to Page1_x and Page1_y, so:
Item one. This creates a "submit" button using an image. A form may have as many as you like, each with a different "Name" property. Image can be a jpeg.
Code: Select all
<INPUT TYPE=image src="ab_add.gif" Name="Page1">Code: Select all
<?php
if (isset($_POST['Page1_x']))
{ header("Location:Page1.html"); // or whatever
exit;
} // repeat for each button/page conbination
?>- Sevengraff
- Forum Contributor
- Posts: 232
- Joined: Thu Apr 25, 2002 9:34 pm
- Location: California USA
- Contact:
if you redirect using header(), is the POST data sent along also?
I had this problem once before. I think I solved it like this:
I had this problem once before. I think I solved it like this:
Code: Select all
<form method="post" action="default.html">
<input> ...
<input type="submit" value="Click for normal action">
<input type="submit" value="go somewhere else" onClick="form.action='different.html';form.submit();">Thank you for the _POST example
<?php
if (isset($_POST['BuyNow_x']))
I have been struggling for days with this!
Thank you!!!!!!!!!!!!!!!!!
if (isset($_POST['BuyNow_x']))
I have been struggling for days with this!
Thank you!!!!!!!!!!!!!!!!!