PHP Form help

following error occur in underneath code.

Notice: Undefined index: inputdata in C:\wamp\www\todo\index.php on line 1

<?php echo $_POST['inputdata']; ?>




That error means that…
[php]
$_POST[‘inputdata’];
[/php]

does not have a value.

if you don’t want the error to show up when you first visit the page you will need to either…

  1. turn error reporting off using " error_reporting(0); "
    or
  2. use an if(isset())…
    [php]
    if(isset($_POST[‘submit’])){
    echo $_POST[‘inputdata’];
    }
    else {




} [/php]

if the form is in the same file as the PHP script then your form tag should look like so…

<form action="" method="post">

Thanks i get the logic,
and also get my code working.

may God keep you happy.

Regards,
Rizwan.

So you got your code working?

Or just set it to NULL before the first line…

Sponsor our Newsletter | Privacy Policy | Terms of Service