1

I have a form on my PHP page which performs some ajax validation (that's working). Here's a snippet (the live form has more fields than this)

    <form name="form" onSubmit="return validate_form();" action="submitform.php" method="post">
        <table border="0" cellpadding="5" bgcolor="#000000">
        <tr>
            <td width="175">
                <div align="right"><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>Requested Vendor TAG:</b> </font></div>
            </td>
            <td>
                <input type="text" name="VendorTAG" onblur="checktag();" maxlength="8"> <div id="vendtag"></div>
            </td>
        </tr>
        <tr>
            <td width="175">
                <div align="right"><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>Contact Name:  </b> </font></div>
            </td>
            <td>
                <input type="text" name="ContactName" maxlength="50">
            </td>
        </tr>

When I click the submit button, it loads this code:

<php ?
if(trim($VendorTAG) == '')
   {
      die('Vendor TAG cannot be blank');
   }
   else if(trim($ContactName) == '')
   {
      die('Contact Name cannot be blank');
   }
?>

(again, there's more of the same, but this illustrates the point)

This all worked perfectly well until the last update from my hoster sometime over christmas, when the form stopped working - but I'm having real difficulty in finding out why..

The server is now running PHP 5.2.11 - am I doing something fundamentally wrong/stupid here?

3
  • We need some 'PHP' Code .. Unless You are asking about HTML/AJAX. Commented Jan 6, 2010 at 4:49
  • PHP code missing. PHP upgrade? What did it upgrade from? Were you relying on register_globals before? Commented Jan 6, 2010 at 4:49
  • yeah, sorry - code was there on the edit page, but not properly formatted to display. should be there now... Commented Jan 6, 2010 at 4:50

2 Answers 2

5

In PHP 5.2 They got rid of register_globals. It is a security nightmare and should not be used.

Use $_POST instead to access Form Elements.

You can find more about register_globals here: http://us.php.net/manual/en/security.globals.php

Sign up to request clarification or add additional context in comments.

1 Comment

thought it might be something like that, but couldn't find the right google foo to unlock the magic ;)
2

POST vars are accessed like this: $_POST["varname"] and not like this: $varname. Alternatively, you can also access them through $_REQUEST too, but ultimately it's up to you.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.