Re: Multiple Submit
| From: | Németh Zoltán | Date: | Mon, 26 Feb 2007 16:35:53 +0000 |
| Subject: | Re: Multiple Submit | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-249461@lists.php.net to get a copy of this message | ||
2007. 02. 26, hétfő keltezéssel 11.23-kor Dan Shirah ezt írta:
> Hello all,
>
> I have a page that has multiple submits on it. One submit is within my
> javascriptfor form checking, the other submit is a button used to populate
> all customer information if an order ID is entered.
>
> Problem: I cannot get the two to coincide at the same time. They both use
> the submit function to send the data to the same page instead of their
> unique individual pages.
>
> Code: Below are the code snipets.
>
>
> <?php echo "<?xml version=\"1.0\"
> encoding=\"iso-8859-1\"?".">"; ?>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
> http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" zK†[‰f¬)L
> xéì–q>
> <html xmlns="http://www.w3.org/1999/xhtml">
> <HEAD>
> <script language="JavaScript">
> <!--
>
> function closeThis() {
> if (window.confirm("Are you sure you want to cancel the payment request?"))
>
> this.window.close();
> }
>
> *function checkForm() {*
>
> // ** START **
> if (inputForm.cc_phone_number.value == "") {
> alert( "Please enter a phone number." );
> inputForm.cc_phone_number.focus();
> return;
> }
>
> if (inputForm.receipt.value == "") {
> alert( "Please select whether or not a receipt was requested." );
> inputForm.phone_number.focus();
> return;
> }
>
> if (inputForm.cc_first_name.value == "") {
> alert( "Please enter a first name." );
> inputForm.cc_first_name.focus();
> return;
> }
>
> if (inputForm.cc_last_name.value == "") {
> alert( "Please enter a last name." );
> inputForm.cc_last_name.focus();
> return;
> }
>
> if (!(document.inputForm.cc_comments.value =="")) {
> if (document.inputForm.cc_comments.value.length > 250)
> {
> alert("The Comments must be less than 250 characters.\nIt is currently "
> + document.inputForm.window_name.value.length + " characters.");
> document.inputForm.window_name.focus();
> return;
> }
> }
> * document.inputForm.submit();*
> }
>
> //-->
> </script>
> <LINK rel="stylesheet" type="text/css"
> href="../../CSS/background.css">
> </head>
> <body>
> *<form name="inputForm" action="save.php" method="post"
> enctype="multipart/form-data">*
> <table align="center" border="0" cellpadding="0"
> cellspacing="0"
> width="680">
> <tr>
> <td height="13" align="center"
> class="tblhead"><strong>Credit Card
> Information</strong></td>
> </tr>
>
> *// LOTS OF FORM DATA REMOVED FOR EMAIL LENGTH*
>
> <table align="center" border="0" cellpadding="0"
> cellspacing="0"
> width="680">
> <tr>
> *This is the other submit that I need to go a page other than the one
> specified in the <form>*
> *<td width="62"><a href="DeferredPayment3.php"><input
> type="submit"
> name="retrieve" value="Retrieve"></a></td>*
> <td width="8"></td>
AFAIK an <input> within an <a> tag will not work ever
why don't you do it the way you do the other submit button? (with
javascript submit();)
greets
Zoltán Németh
> </tr>
> </table>
> <br />
> <br />
> <table align="center" border="0" cellpadding="0"
> cellspacing="0"
> width="680">
> <tr>
> *Call to the javascript checkForm function*
> *<td width="64" align="left"><a
> href="javascript:checkForm()"
> title="Save">Save</a></td>
> * <td width="616" align="left"><a
> href="javascript:closeThis()"
> title="Close">Close</a></td>
> </tr>
> </table>
> </form>
> </body>
> </html>