if(isset($_POST["submit"])) returning false

If by that you mean you changed the form to use method='get', that indicates that the method=‘post’ markup wasn’t what it appeared to be. Delete and retype method='post'

Tried that and it’s not making any difference

So, something is apparently causing the $_POST array to be empty. The only thing I know of is if the post_max_size setting is set to a small value. Any chance you have changed this and due to a syntax problem in the value, it is not really what you think? What does a .php script file with a phpinfo() statement in it show for the post_max_size?

Unfortunately, you copied that from a non-code context, where the forum software ‘beautified it’ and it picked up smart-curly quotes that are meaningless to php.

Do this…

This will kill the page once you post it and display what is being posted.
Make sure the data you entered shows up in the $_POST[] array.
If the data is not correct, then, something is wrong in your form.
If the data is correct, then, the validation sections are incorrect.

The issue with this is

if($_SERVER[‘REQUEST_METHOD’] == ‘POST’) {

this line doesn’t work so this

die("< pre>".print_r($_POST)."< /pre>");

never gets run

Well, take out the quotes and put in real ones! Curly-q-quotes are for text editors and fancy displays not for coding! Phdr told you this already! That line will never work with fake quotes… Hope that helps…

post_max_size is 32M according to my phpinfo()

I did change the quotes, I just didn’t have my code editor open at the time I sent that message so I copied what was on this tread before

Well, we can only help by viewing your code, so if you post it wrong, that is what we go by. Sorry for the confusion.

I suggest you temporarily replace the POST php file with just this.
< ?PHP

if($_SERVER['REQUEST_METHOD'] == 'POST') {
echo "<pre>" . print_r($_POST, 1) . "</ pre>";
?>

And, make sure that ALL of the data you enter into the form is passed onto this file.
That would be debug step #1. Making sure your server is passing data thru the POST array.

Then, if that is working 100% correctly, you need to add in parts of the rest of that page step by step.
And, see where it fails… I have never had the server-request-method fail, so feel there must be something else causing the error. What IDE are you using, meaning, what editor are you using?
Perhaps the IDE is changing something or not showing an error on one of the pages.

hmmm, ok so after trying that it seems to be working, however when I deploy the files to my actual website it isn’t and is running the else loop.

With a blank file except for what you sent on my actual website I get a blank page appearing.
After adding

else {
    echo "Did not work";
}

And redoing the form it then echoed back “Did not work”

Well, then either your server has an issue or one of your files is not copied to the server correctly.

Do you host your server or is it a canned shared server?

Oh, also, your config file might not be making the connection to the live database correctly.
Do you have error checking turned on? Have you looked at the server logs to see what is happening?

Sponsor our Newsletter | Privacy Policy | Terms of Service