0

Hi everyone,
Please check php code below, when i load this page in browser it gives me following errors.

"Notice: Undefined index: submit in E:\wamp\www\login\register.php on line 4"
"Notice: Undefined index: fullname in E:\wamp\www\login\register.php on line 5"
"Notice: Undefined index: username in E:\wamp\www\login\register.php on line 6
"Notice: Undefined index: password in E:\wamp\www\login\register.php on line 7"
"Notice: Undefined index: repeatpassword in E:\wamp\www\login\register.php on line 8"

I want that when i submit the form it echo back fullname, username etc. I will highly appreciate who solves my problem.

<?php
echo "<h1>Register</h>";

    $submit = $_POST['submit'];
    $fullname = $_POST['fullname'];
    $username = $_POST['username'];
    $password = $_POST['password'];
    $repeatpassword = $_POST['repeatpassword'];
    
    if($submit)
    {
        echo"$submit, $fullname, $username, $password, $repeatpassword";
    }
?>
<html>
    
    <form action="register.php" method="POST">
        <table>
            <tr>
                <td>Full name : </td>
                <td>
                    <input type="text" name="fullname" />
                </td>
            </tr>
            
            <tr>
                <td>Username : </td>
                <td>
                    <input type="text" name="username" />
                </td>
            </tr>
            
            <tr>
                <td>Password : </td>
                <td>
                    <input type="password" name="password" />
                </td>
            </tr>
            
            <tr>
                <td>Re-type Password : </td>
                <td>
                    <input type="password" name="repeatpassword" />
                </td>            
            </tr>
            
            <tr>
                <td>
                    <input type="submit" name="submit" value="Register" />
                </td>
            </tr>            
        </table>   
    </form>
    
</html>
2
Contributors
4
Replies
5
Views
6 Years
Discussion Span
Last Post by new_developer
0

You're running the page even though you haven't posted a form to it, so $_POST[...], doesn't exist.

Can't see why you're doing this in the same page, as once you're registered, you don't want to be faced with a reg form again, right?

0

You're running the page even though you haven't posted a form to it, so $_POST[...], doesn't exist.

Can't see why you're doing this in the same page, as once you're registered, you don't want to be faced with a reg form again, right?

Actually I am following a tutorial, on youtube. That man do like this, but he didn't get any errors. When he clicks register button, the username, password etc print on top of same page.

2

Oh well. If you don't know how to code, get a book, follow some text-based tutorials, download the php manual from php.net, etc, etc, etc.

Unless you understand the basics, a solution here will be of no use as you won't know how to fix it if it doesn't work exactly the way you want. I'm not being dismissive, just constructive. Get a grip on the language first. "Script bunnying" never leads to success.

Good luck though.:)

Votes + Comments
good poster, you deserve this 1 point reputation...
0

Oh well. If you don't know how to code, get a book, follow some text-based tutorials, download the php manual from php.net, etc, etc, etc.

Unless you understand the basics, a solution here will be of no use as you won't know how to fix it if it doesn't work exactly the way you want. I'm not being dismissive, just constructive. Get a grip on the language first. "Script bunnying" never leads to success.

Good luck though.:)

Yeah i am beginner, and i am looking forward for your response when i have problem in future.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.