Jump to content

php & froms


Sh13

Recommended Posts

:) hii have a problemwhen i create a form and wanna use the form variables , first when the page loads , it errors and says that the variables are not defined ! ofcourse after submiting the form i can use the variables , but i dont wanna that errors be shown at first.can u please help me :) ?
Link to comment
Share on other sites

Hi!Try this:

if (isset($_POST['AnyFieldName'])) {// ... (The code that uses $_POST['FieldName']/takes care of the input from the form)}...

Good Luck and Don't Panic!

Link to comment
Share on other sites

You can also just disable the output of notices. There are several types of messages in PHP, there are fatal errors, warnings, notices, parse errors, startup errors, etc. Notices are the least severe (such as an unitialized variable). If you want to disable the reporting of notices, you can add this line to the top of your script:error_reporting(E_ALL ^ E_NOTICE);That will display all messages except notices. This is the default in php.ini. You can also change the value directly in php.ini (if you can edit the file on the server), in which case you would not have to put the above line of code in all of your PHP files.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...