0
votes

i am designing a login page using html and php.it includes two buttons one for login and another one to redirect to the registration page.i am planning to use php code to validate login data on the same page.here is my code

<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" method="post">
<div>
    <table style="width: 100%; height: 377px;">
        <tr>
            <td rowspan="4"><img src="woman.jpg" height="100%" width="100%" alt="woman"/></td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
        </tr>


        <tr>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td align="right" style="padding:0px;color:white" >username:</td>
            <td><input runat="server" name="Text1" type="text" /></td>
        </tr>
        <tr>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td align="right" style="padding:0px;color:white">password</td>
            <td><input runat="server" name="Text2" type="text" /></td>
        </tr>
        <tr>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td></td>
            <td ><input  name="Submit1" type="submit" value="login" />&nbsp;
            <input onclick="document.location.href='regforswa.php'" name="Submit2" type="submit" value="register" /><br/>
            <a href="fp.php" style="color:white">forgot password</a></td>
        </tr>
    </table>
</div>

</form>

but the button for registration is not working properly.it is not redirecting to the registration page.i don't want to put register button outside the form.i want to keep the same design and achieve required functionality.

1
why don't you make register button type to type="button"Rakesh Shetty

1 Answers

1
votes

Change the Button-Type from type="submit" to type="button" to disable the form submission:

 <input onclick="document.location.href='regforswa.php'" name="Submit2" type="button" value="register" />