Hey I want when i click the submit button it runs a php script that then loads it to a local database where I can then use the entered data as a way for someone to login into the site but everytime i click the submit, it downloads the whole php file. The form is in html and in the same folder as the php file. my html code is:
<form action="register.php" method="post">
<table border="0" width="225" align="center">
    <tr>
        <td width="219" bgcolor="#999999">
            <p align="center"><font color="white"><span style="font-size:12pt;"><b>Registration</b></span></font></p>
        </td>
    </tr>
    <tr>
        <td width="219">
            <table border="0" width="282" align="center">
                    <tr>
                        <td width="116"><span style="font-size:10pt;">Name:</span></td>
                        <td width="156"><input name="name" type="text" id="name" maxlength="100"></td>
                    </tr>
                    <tr>
                        <td width="116"><span style="font-size:10pt;">Email:</span></td>
                        <td width="156"><input name="email" type="text" id="email" maxlength="100"></td>
                    </tr>
                <tr>
                    <td width="116"><span style="font-size:10pt;">Username:</span></td>
                    <td width="156"><input name="username" type="text" id="username"></td>
                </tr>
                <tr>
                    <td width="116"><span style="font-size:10pt;">Password:</span></td>
                    <td width="156"><input name="password" type="password" id="password"></td>
                </tr>
                <tr>
                    <td width="116">&nbsp;</td>
                        <td width="156">
                            <p align="right"><input name="Submit" type="submit" onclick="MM_validateForm('name','','R','email','','RisEmail','username','','R','password','','R');return document.MM_returnValue" value="Send"></p>
                        </td>
                </tr>
            </table>
        </td>
    </tr>
    <tr>
        <td width="219" bgcolor="#999999">&nbsp;</td>
    </tr>
</table>
</form>
Member Avatar

deleted1234

Maybe because you don't need to include onclick="MM_validateForm(...)" on your Submit button anymore.

Since you used POST as your form method, on your register.php script you can get all the values of your form by doing:

$name = $_POST;
$email = $_POST;
$username = $_POST;
$password = $_POST;

Thats only there so that it wouldn't allow either a blank field or a bad email address to be entered, even before I place that there it was doing the same thing

Member Avatar

diafol

Something tells me you haven't got a localhost server set up. Have you got apache (or IIS) and php installed and fired up?

If so, try the following. OK, stripped to bare bones:

<form action="register.php" method="post">
 Name: <input name="name" type="text" id="name" maxlength="100" />
 Email: <input name="email" type="text" id="email" maxlength="100" />
 Username: <input name="username" type="text" id="username" />
 Password: <input name="password" type="password" id="password" />
 <input name="Submit" type="submit" value="Send" />
</form>

Does this work?

Its the same thing sadly, and yes its up and running. I know its up because when I used only php to input static data (insert into table etc etc), it was added to the table wit no problem

Member Avatar

diafol

Ok, shouldn't make a difference, but change the form page to php extension.

Thats what I did, I took everything out of the registration html, and copied it over into a php file so now it writes to the database perfectly, but now I have to create a login screen that fetches that data in the database, and I also have to enable only a few functions to people whom visit, any online tutorial would be great, I already see that I may have to convert all of my html my files to php.

Member Avatar

diafol

Ok, my oversight. Search Daniweb or any good php forum for login scripts. There are thousands. Go for one that uses sessions.