Jump to content

Recommended Posts

Notice: Undefined index: submit in C:\Program Files\EasyPHP 2.0b1\www\index.php on line 5

 

<html>

<head></head>

<body>

<?php

if (!$_POST['submit']) <----- this is the line 5

{

// form not submitted

 

?>

<form action="<?=$_SERVER['PHP_SELF']?>" method="post">

Username: <input type="text" name="username"><br>

Password: <input type="password" name="password"> <br><br>

<input type="submit" value="Sign Up" name="submit" />

 

</form>

Link to comment
https://forums.phpfreaks.com/topic/175591-submit-problem-in-line-5/
Share on other sites

 

<?php

if (!$_POST['submit']) <----- this is the line 5

{

// form not submitted

 

?>

 

Your missing the trailing (closing) bracket.. "}"

 

<?php
if (!$_POST['submit']) <----- this is the line 5
 {
	// form not submitted
         }	
?>

 

 

The code: if (!$_POST['submit']) causes the the post variable to be evaluated. However, when the variable does not exist (your form has not been submitted yet) that generates an error. You need to use isset() to prevent that specific error for a variable that optionally might not exist -

 

 if (!isset($_POST['submit']))

<?php

if (!$_POST['submit']) <----- this is the line 5

{

// form not submitted

              }

 

?>

 

when you enable in php.ini or use in any php file this funcion ERROR REPORTING

then it will tell you proper and all possible errors in your php page.

 

and over here in your code you sould write like this

 

 

if ( !isset($_POST['submit']) ) {

  // do what every

}

 

if ( !empty($_POST['submit']) ) {

  // do what every

}

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.