user3849771
user3849771

Reputation: 57

Why is the button not redirecting?

<form action="../includes/process_login.php" method="post" name="login_form">   
                    <div class="form-group">
                        <label class="control-label">Username</label>
                        <input type="text" class="form-control" name="username" />
                    </div>
                    <div class="form-group">
                        <label class="control-label">Password</label>
                        <input type="password" class="form-control" name="password" />
                    </div>
                    <div class="text-center">
                        <input type="button" 
                           value="Sign in" 
                           class="btn btn-primary" 
                           action="../includes/process_login.php"/> 
                    </div>
                </form>

Hello all, I have been following a tutorial and stumbled upon this error. Whenever I try to click the Sign-in button, it doesn't re-direct me. It is supposed to log me in.

Thank you in advance.

Upvotes: 0

Views: 310

Answers (2)

Lal
Lal

Reputation: 14810

The correct syntax for button(submit) is as follows

<input type="submit" value="Submit">

Thus, your button should be changed as

<input type="submit" value="Sign in" class="btn btn-primary"/> 

On clicking this submit button, the form is submitted to the page apecified in the attribute action of the <form>

Read more about it here

Upvotes: 1

gotha
gotha

Reputation: 489

Remove the "action" from input and change its type to "submit".

<input type="submit" value="Sign in" class="btn btn-primary" /> 

This will submit the form to "../includes/process_login.php".

Upvotes: 1

Related Questions