Jump to content

Undefined variable


madlady37

Recommended Posts

Hello All,

Im new with php. I am making a simple login form, and want to echo the variables.

here is my code:

Help!

 

<body>

<form id="myForm" method="post">
    <table width="400" border="5" align="center">

    <tr>
        <td colspan="5"><h1>Registration Form</h1></td>
    <tr>

    <tr>
        <td>User Name:</td>
        <td><input type="text" name="name"/></td>
    <tr>
    
    <tr>
        <td>User Password:</td>
        <td><input type="password" name="password"/></td>
    <tr>

    <tr>
        <td>Email:</td>
        <td><input type="text" name="email"/></td>
    <tr>

    <tr>
        <td colspan="5" align="center"><input type="submit" name="submit" value="Sign Up"/>
<input type="button" onClick="myFunction()" value="Reset" class="masterTooltip" title="Click Here to Start Over."><br /></td>
                
             
 
</table>
</form>
<script>
    function myFunction() {
    document.getElementById("myForm").reset();
    }
</script>








</body>
</html>
<?php

if ($_SERVER['REQUEST_METHOD']=='POST') {

    
    echo $user = $_POST['username'];
    echo $password = $_POST['password'];
    echo $email = $_POST['email'];
    
    
}


?>

 

 

 

This is the error message I get.

Notice: Undefined index: username in C:\xampp\htdocs\The Centorium\registration.php on line 60

Edited by madlady37
Link to comment
Share on other sites

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.