Jump to content

SUBMIT Problem in line 5


lheonx

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

}

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.