PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I'm having a nightmare with this. It's a simple form using the POST method but the script on the other side is not picking any of the variables up that have been sent. Can anyone tell me why?
This is the header.php file containing the form, which is included by the index.php.
Could be some problem in the javascript function valid(). Try removing the onSubmit="return valid(this);" to isolate.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
AbraCadaver wrote:Could be some problem in the javascript function valid(). Try removing the onSubmit="return valid(this);" to isolate.
Good thinking, but its still the same.
Array ( ) login is not working
Warning: Cannot modify header information - headers already sent by (output started at D:\inetpub\vhosts\northerngraphic.co.uk\httpdocs\password.php:4) in D:\inetpub\vhosts\northerngraphic.co.uk\httpdocs\password.php on line 124
AbraCadaver wrote:Could be some problem in the javascript function valid(). Try removing the onSubmit="return valid(this);" to isolate.
Good thinking, but its still the same.
Array ( ) login is not working
Warning: Cannot modify header information - headers already sent by (output started at D:\inetpub\vhosts\northerngraphic.co.uk\httpdocs\password.php:4) in D:\inetpub\vhosts\northerngraphic.co.uk\httpdocs\password.php on line 124
We'd need to see all of the password.php code to tell.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
AbraCadaver wrote:Could be some problem in the javascript function valid(). Try removing the onSubmit="return valid(this);" to isolate.
Good thinking, but its still the same.
Array ( ) login is not working
Warning: Cannot modify header information - headers already sent by (output started at D:\inetpub\vhosts\northerngraphic.co.uk\httpdocs\password.php:4) in D:\inetpub\vhosts\northerngraphic.co.uk\httpdocs\password.php on line 124
We'd need to see all of the password.php code to tell.
Without trying to echo the variables it just sends me back to the index with err=1 in the url.
Jade wrote:Have you tried doing print_r($_POST); in the password.php page?
That returns Array ( )
??
That means none of the form variables are being sent. $_POST is always present, and will always be an array. Only if a form is submitted will $_POST be populated.
Is the form being submitted at all? What happens if you try to reload the page after you submit the form? Does it ask you to resubmit form data or does it happily reload? If it doesn't ask you to resubmit, then your form isn't being submitted in the first place.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Jade wrote:Have you tried doing print_r($_POST); in the password.php page?
That returns Array ( )
??
That means none of the form variables are being sent. $_POST is always present, and will always be an array. Only if a form is submitted will $_POST be populated.
Is the form being submitted at all? What happens if you try to reload the page after you submit the form? Does it ask you to resubmit form data or does it happily reload? If it doesn't ask you to resubmit, then your form isn't being submitted in the first place.
It mustn't be being submitted because it isn't asking me to resend the data. Why would my submit button not be submitting the data?
You're using <a> elements to trigger form submission, not <input> elements. When the link is clicked, it is followed - regardless of what Javascript you have running. If you want to have the form submitted when you click the link, have your submitForm() function return boolean false.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
<form action=post>
... form stuff here
<form action=post>
..more form stuff here
</form>
</form>
I'm not unfortunately.
pickle wrote:You're using <a> elements to trigger form submission, not <input> elements. When the link is clicked, it is followed - regardless of what Javascript you have running. If you want to have the form submitted when you click the link, have your submitForm() function return boolean false.
Ok, so I know there is nothing wrong with the form because if I change form action to testscript.php which contains the first few lines of password.php