I have a problem with my form. So in my logandreg.html
I have 2 forms. One for login which is
<form method="post" action="valid.php">
<p>
Username:
<input type="text" name="login_username">
</p>
<p>
Password:
<input type="password" name="login_pass">
</p>
<div class="clear"></div>
<div class="form-row login">
<p>
<input type="submit" value="Login" id="login" name="login" class="button alt">
</p>
and another form for register
<form method="post" action="register.php">
<p>
Username:
<input type="text" name="username">
</p>
<p>
Password:
<input type="password" name="pass">
</p>
<p>
E-mail:
<input type="text" name="email">
</p>
<div class="clear"></div>
<div class="form-row reg">
<p>
<input type="submit" data-value="Register" value="Register" id="reg" name="reg" class="button alt">
</p>
But why when I click on the submit button on the register part it always bring me to valid.php
which is from the login form? Both of these form are in the same html. In the valid.php
I have this
<?php
session_start();
if(isset($_POST['login']))
{...}
?>
and in the register.php
I have this
<?php
if(isset($_POST['reg']))
{...}
?>
Why does it always bring me to the valid.php
when I click on the register button? Where is my mistake? Thanks