Jump to content

html/php


dan09

Recommended Posts

I was following your excellent tutorial on how to create a user login in and register.

The problem i have is when i load up the register.php file in the browser i get err messages like undefined index

I have looked at other peoples comments but cannot fix this issue.

Please can you help me? Thanks

 

[attachment deleted by admin]

Link to comment
Share on other sites

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

$submit = $_POST['submit'];

if (isset($submit))
{

$fullname = $_POST['fullname'];
$username = $_POST['username'];
$password = $_POST['password'];
$repeatpassword = $_POST['repeatpassword'];	

echo "{$username}/{$password}/{$repeatpassword}/{$fullname}";
}

?>


<html>

<form action='/1/register.php' method='POST'>
<table>
    <tr>
    <td>
    Your full name:
    </td>
    <td>
    <input type='text' name'fullname'>
    </td>
    </tr>
     <tr>
    <td>
    Choose a username:
    </td>
    <td>
    <input type='text' name'username'>
    </td>
    </tr>
     <tr>
    <td>
    Choose a Password:
    </td>
    <td>
    <input type='password' name'password'>
    </td>
    </tr>
     <tr>
    <td>
    Repeat password:
    </td>
    <td>
    <input type='password' name'repeatpassword'>
    </td>
    </tr>
   
    </table>
    <p>
    <input type='submit' name 'submit' value='Register'>
</form>

</html>

 

this is most likely just a notice, and is triggered because you indices aren't being used until you submit the form...the best thing to do here is to check that the submit button has been set, then set your POST variables like I have don above

Link to comment
Share on other sites

the index notice refers to $submit = $_POST['submit']

this is only a notice and can really be ignored in this case..basically by setting it to a variable you are initializing the $_POST index without that index having a value since you havn't submitted the form...this will not effect your script whatsoever

Link to comment
Share on other sites

1. when you click submit...does it keep you on the same page?

2. do you have error_reporting set to E_ALL? If so, what errors do you receive in your error.log?

 

ini_set("error_reporting",E_ALL);

 

1) yes it does (register.php)

2) no i havent, where would i put this in the script?

Link to comment
Share on other sites

top of your php portion...okay so the action is correct..

if you want the errors to be displayed on your webpage instead of having to go to the error.log which you might even know where it is, put this as well on the top of you php code..

 

ini_set("display_errors","ON");

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.