RE: Javascript and $_POST

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> -----Original Message-----
> From: Dan Shirah [mailto:mrsquash2@xxxxxxxxx]
> Sent: Wednesday, February 07, 2007 4:35 PM
> To: php-general
> Subject:  Javascript and $_POST
> 
> I have a form that uses Javascript to validate form field entries, and if
> they are incorrect it returns an error to the user.
> 
> After the Javascript processing is complete, it submits the form to my
> save
> page. However it seems that once the processing is complete and it passes
> to
> the save page, none of my $_POST variables are being passed.
> 
> Is this normal, or is there a work around for it?
> 
> My Javascript has multiple checks. Below is a very condensed version:
> 
> <script language="JavaScript">
> function checkForm() {
> 
> if (inputForm.cc_phone_number.value == "") {
> alert( "Please enter a phone number." );
> inputForm.cc_phone_number.focus();
> return;
> }
> 
> document.Submit.submit();
> }
> </script>
> 
> And this is my Save option at the bottom of my page
> 
> <form name="Submit" action="save.php" method="post"
> enctype="multipart/form-data">
> <table align="center" border="0" cellpadding="0" cellspacing="0"
> width="680">
> <tr>
> <td width="64" align="left"><a href="javascript:checkForm()"
> title="Save">Save</a></td>
> </tr>
> </table>
> </form>
> 
> When I click on save, it does go thru all the checks correctly and prompts
> to enter info if anything is left out. It then passes me to the
> save.phppage as it should, but all of my $_POST('XXXXX') values come
> in blank.


>From the looks of it, you have two forms - one called "Submit" and one
called "inputForm".  You need to submit the "inputForm" for the values to be
passed to the processing page.

document.inputForm.submit();

HTH,

Brad



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux