Failure receiving POST results in PHP/HTML - php

I've done tests and it's definitely not a problem with the database, it connects fine and variables input if specified, (the integers work). Note that the {} brackets around the variables in the sql statement, for some reason need to be there for it to work, if someone could tell me why that'd be great.
The main problem is the POST for receiving from the form, nothing echoes, nor inputs to the database. Can anyone help? Thanks in advance.
PHP:
$firstName = $_POST['firstName'];
$lastName = $_POST['lastName'];
$username = $_POST['username'];
$pw = $_POST['pw'];
$email = $_POST['email'];
$wins = 0;
$losses = 0;
$played = 0;
$earnings = 0;
$sql = "
INSERT INTO users (first_name, last_name, username, password, email, last_login, date_joined, wins, losses, played, earnings) VALUES
('{$firstName}','{$lastName}','{$username}','{$pw}','{$email}','1111','2222','{$wins}','{$losses}','{$played}','{$earnings}')
";
if(!mysql_query($sql, $con)){
echo 'Worked';
} else {echo 'Failed';}
HTML:
<form id="registration_form" action="http://valhq.com/register/" method="POST">
<div class="signup_form_content_names">
<div class="signup_form_input_fn">
<input type="text" class="signup_input_style_fn" id="firstName" placeholder="First Name" maxlength="20">
</div>
<div class="signup_form_input_ln">
<input type="text" class="signup_input_style_ln" id="lastName" placeholder="Last Name" maxlength="20">
</div>
</div>
<div class="signup_form_content">
<div class="signup_form_input">
<input type="text" class="signup_input_style" placeholder="E-Mail" id="email" maxlength="40">
</div>
<div class="signup_form_input">
<input type="text" class="signup_input_style" placeholder="Confirm E-Mail" id="emailconf" maxlength="40">
</div>
<div class="signup_form_input">
<input type="text" class="signup_input_style" placeholder="Desired Username" id="username" maxlength="20">
</div>
<div class="signup_form_input">
<input type="password" class="signup_input_style" placeholder="Password" id="pw" maxlength="64">
</div>
<div class="signup_form_input">
<input type="password" class="signup_input_style" placeholder="Confirm Password" id="pwconf" maxlength="64">
</div>
<div class="signup_tc">
<p>
<input type="checkbox" id="terms" value="terms_true" style="vertical-align:middle;">
I agree to the Terms and Conditions
<span class="signup_tc_required">*</span>
</p>
</div>
<input type="submit" id="submit" class="signup_submit" value="Create Account">
<div class="signup_alreadyMember">
Already a member? Login.
</div>
<div class="signup_error">
<span class="signup_error" id="fn_error_message"></span>
<span class="signup_error" id="ln_error_message"></span>
<span class="signup_error" id="email_error_message"></span>
<span class="signup_error" id="emailconf_error_message"></span>
<span class="signup_error" id="username_error_message"></span>
<span class="signup_error" id="pw_error_message"></span>
<span class="signup_error" id="pwconf_error_message"></span>
<span class="signup_error" id="tos_error_message"></span>
</div>
</div>
</form>

if you want to get your values using $_POST your inputs name attributes must be set
example add name="firstName"
<input type="text" class="signup_input_style_fn" name="firstName" id="firstName" placeholder="First Name" maxlength="20">
So now you can access it using
$firstName = $_POST['firstName'];

Change your "Id" to "name",and you will succeed.

You are missing name attribute from input , if you are not using ajax then you require name attribute
Use This
<form id="registration_form" action="http://valhq.com/register/" method="POST">
<div class="signup_form_content_names">
<div class="signup_form_input_fn">
<input type="text" class="signup_input_style_fn" id="firstName" name="firstName" placeholder="First Name" maxlength="20">
</div>
<div class="signup_form_input_ln">
<input type="text" class="signup_input_style_ln" id="lastName" name="lastName" placeholder="Last Name" maxlength="20">
</div>
</div>
<div class="signup_form_content">
<div class="signup_form_input">
<input type="text" class="signup_input_style" placeholder="E-Mail" id="email" name="email" maxlength="40">
</div>
<div class="signup_form_input">
<input type="text" class="signup_input_style" placeholder="Confirm E-Mail" id="emailconf" name="emailconf" maxlength="40">
</div>
<div class="signup_form_input">
<input type="text" class="signup_input_style" placeholder="Desired Username" id="username" name="username" maxlength="20">
</div>
<div class="signup_form_input">
<input type="password" class="signup_input_style" placeholder="Password" id="pw" name="pw" maxlength="64">
</div>
<div class="signup_form_input">
<input type="password" class="signup_input_style" placeholder="Confirm Password" id="pwconf" name="pwconf" maxlength="64">
</div>
<div class="signup_tc">
<p>
<input type="checkbox" id="terms" name="terms" value="terms_true" style="vertical-align:middle;">
I agree to the Terms and Conditions
<span class="signup_tc_required">*</span>
</p>
</div>
<input type="submit" id="submit" name="submit" class="signup_submit" value="Create Account">
<div class="signup_alreadyMember">
Already a member? Login.
</div>
<div class="signup_error">
<span class="signup_error" id="fn_error_message"></span>
<span class="signup_error" id="ln_error_message"></span>
<span class="signup_error" id="email_error_message"></span>
<span class="signup_error" id="emailconf_error_message"></span>
<span class="signup_error" id="username_error_message"></span>
<span class="signup_error" id="pw_error_message"></span>
<span class="signup_error" id="pwconf_error_message"></span>
<span class="signup_error" id="tos_error_message"></span>
</div>
</div>
</form>

Can you try echoing the variables in your php file to check if the variables are being set to the correct values from the form.
for example
echo "first name: $firstName";
echo "email: $email";
And I would also advise if you can try directly putting the actual php file in the action of your form. Just like below:
<form id="registration_form" action="<your php file here>" method="POST">

Related

html form validation using php

I have created a html form which has signup as well as login. Firstly I want to register the user using signup form and then make him login then redirect to another page. For this I'm using php with apache(xampp) server. The signup panel is working fine, but when I try to login, black column is added to database
My html code is like this
<form method="POST" action="yoga_signup.php">
<div class="row" style=" margin-top:4rem; margin-left:24rem;">
<div class="col-md-6 mx-auto p-0">
<div class="card">
<div class="login-box">
<div class="login-snip"> <input id="tab-1" type="radio" name="tab" class="sign-in" checked><label for="tab-1" class="tab">Login</label> <input id="tab-2" type="radio" name="tab" class="sign-up"><label for="tab-2" class="tab">Sign Up</label>
<div class="login-space">
<div class="login">
<input type="hidden" name="for_page" value="login">
<div class="group"> <label for="user" class="label">Username</label> <input id="user" type="text" class="input" name="username" placeholder="Enter your username" > </div>
<div class="group"> <label for="pass" class="label">Password</label> <input id="pass" type="password" name="password_1" class="input" data-type="password" placeholder="Enter your password" > </div>
<div class="group"> <input id="check" type="checkbox" class="check" checked> <label for="check"><span class="icon"></span> Keep me Signed in</label> </div>
<div class="group"> <input type="submit" class="button" value="Sign In"> </div>
<div class="hr"></div>
</div>
<div class="sign-up-form">
<input type="hidden" name="for_page" value="signup">
<div class="group"> <label for="user" class="label">Username</label> <input id="user" type="text" name="username" class="input" placeholder="Create your Username"> </div>
<div class="group"> <label for="pass" class="label">Password</label> <input id="pass" type="password" name="password_1" class="input" data-type="password" placeholder="Create your password" > </div>
<div class="group"> <label for="pass" class="label">Repeat Password</label> <input id="pass" type="password" name="password_2" class="input" data-type="password" placeholder="Repeat your password"> </div>
<div class="group"> <label for="pass" class="label">Email Address</label> <input id="pass" type="text" class="input" name="email" placeholder="Enter your email address" > </div><br>
<div class="group"> <input type="submit" class="button" value="Sign Up"> </div>
<div class="hr"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</form>
and my php code is this
<?php
session_start();
$conn= new mysqli("localhost","root","","yoga");
if($_SERVER["REQUEST_METHOD"]=="POST"){
$TypeOfRequest=$_POST['for_page'];
if($TypeOfRequest=="signup"){
$user=$_POST['username'];
$pass_1=$_POST['password_1'];
$pass_2=$_POST['password_2'];
$mail=$_POST['email'];
if($pass_1===$pass_2){
$val=" INSERT INTO yoga_login(username,password_1,password_2,email) VALUES('$user','$pass_1','$pass_2','$mail')";
if($conn->query($val)===TRUE){
header('Location: login.html');
}else{
echo "registration unsucessfull";
}
}
if($pass_1!==$pass_2){
echo "please enter the same password";
}
}
$TypeofRequest = $_POST['for_page'];
if($TypeofRequest=="login"){
$user=$_POST['username'];
$pass_1=$_POST['password_1'];
$sql="SELECT * FROM yoga_login WHERE username='$user' AND password='$pass_1'";
$RunQuery = mysqli_query($conn,$sql);
$CheckNumberOfUsers = mysqli_num_rows($RunQuery);
//echo $CheckNumberOfUsers;
if($CheckNumberOfUsers==1){
$_SESSION['username'] = $user;
header('location:blogs.html');
}else{
echo "invalid credential";
}
}
mysqli_close($conn);
}
You can dump out what you are sending in the yoga_signup.php at the start of the file:
die('<pre>' . print_r($_POST, true) . '</pre>');
Then you can see this:
Array
(
[tab] => on
[for_page] => signup
[username] =>
[password_1] =>
[password_2] =>
[email] =>
)
so the for_page field's value is signup - and I was pressing the Sign In button
Then you go back to the HTML file and you can see that you are using the same form for the request, so with the second <input type="hidden" name="for_page" value="signup">, you are overwriting the first for_page value.
So instead of this you should create 2 forms and set them like this:
<div class="row" style=" margin-top:4rem; margin-left:24rem;">
<div class="col-md-6 mx-auto p-0">
<div class="card">
<div class="login-box">
<div class="login-snip">
<input id="tab-1" type="radio" name="tab" class="sign-in" checked>
<label for="tab-1" class="tab">Login</label>
<input id="tab-2" type="radio" name="tab" class="sign-up">
<label for="tab-2" class="tab">Sign Up</label>
<div class="login-space">
<form method="POST" action="yoga_signup.php">
<div class="login">
<input type="hidden" name="for_page" value="login">
<div class="group">
<label for="user" class="label">Username</label>
<input id="user" type="text" class="input" name="username" placeholder="Enter your username" >
</div>
<div class="group">
<label for="pass" class="label">Password</label>
<input id="pass" type="password" name="password_1" class="input" data-type="password" placeholder="Enter your password" >
</div>
<div class="group">
<input id="check" type="checkbox" class="check" checked>
<label for="check">
<span class="icon">
</span> Keep me Signed in
</label>
</div>
<div class="group"> <input type="submit" class="button" value="Sign In"> </div>
<div class="hr"></div>
</div>
</form>
<form method="POST" action="yoga_signup.php">
<div class="sign-up-form">
<input type="hidden" name="for_page" value="signup">
<div class="group"> <label for="user" class="label">Username</label> <input id="user" type="text" name="username" class="input" placeholder="Create your Username"> </div>
<div class="group"> <label for="pass" class="label">Password</label> <input id="pass" type="password" name="password_1" class="input" data-type="password" placeholder="Create your password" > </div>
<div class="group"> <label for="pass" class="label">Repeat Password</label> <input id="pass" type="password" name="password_2" class="input" data-type="password" placeholder="Repeat your password"> </div>
<div class="group"> <label for="pass" class="label">Email Address</label> <input id="pass" type="text" class="input" name="email" placeholder="Enter your email address" > </div><br>
<div class="group"> <input type="submit" class="button" value="Sign Up"> </div>
<div class="hr"></div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
Parameters in the PHP file after modification:
Array
(
[for_page] => login
[username] => asdf
[password_1] => asdf
)
Helpful sidenotes to improve your code:
passwords should be encrypted in the database
the mysql query is vulnerable against SQL injection
the second password field used to be required, because if the input type is password, then you can't see the characters, so it's like a proofread for the user to make sure that you won't miss the password. Because of this you don't need to store it in the database, but use it to check if it was written correctly in the first field.
use the redirection headers with die
close the mysql connection before the redirection
I found some issues at the login part of the code.
Instead of the password filed in the SQL query string you should use an existing password field from your database; for example the password_1 field.
Replacing that and fixing some minor issues, plus a bit of beautifying you will get this code for the login part:
if($TypeofRequest=="login"){
$username = $_POST['username'];
$password = $_POST['password_1'];
$sql="SELECT * FROM yoga_login WHERE username='{$username}' AND password_1='{$password}'";
$result = $conn->query($sql);
$conn->close();
if (empty($result)) {
die('invalid credentials');
}
$_SESSION['username'] = $user;
header('location:blogs.html');
die();
}

Run php file when submit button in another html file

I would like to work on registration process for which with the help of Google and Youtube i have created "Sign-in & Sing-up" page togather with toggle option however unable to run registration.php file once user provide registration info at login.html file. Codes are as follows :
<form id="login" class="input-group">
<input type="text" class="input-field" placeholder="User Id" required>
<input type="password" class="input-field" placeholder="Enter Password" required>
<input type="checkbox" class="check-box"><span>Remember Password</span>
<button type="submit" class="submit-btn">Sign-In</button>
</form>
<form Id="register" class="input-group">
<input type="text" class="input-field" placeholder="User Id" required>
<input type="email" class="input-field" placeholder="Email Id" required>
<input type="password" class="input-field" placeholder="Enter Password" required>
<input type="password" class="input-field" placeholder="Confirm Password" required>
<input type="phone-number" class="input-field" placeholder="Mobile Number" required>
<input type="checkbox" class="check-box"><span>I agree to the terms & conditions</span>
<button type="submit" class="submit-btn">Sign-Up</button>
</form>
How to execute registration.php file when Sign-up button clicked at login.html file? Same goes for login option too.
Make sure to add method="POST" and action="path/function.php" and name="desiredName"in your forms like this:
<form id="login" class="input-group" method="POST" action="file_path/login.php">
<input type="text" class="input-field" placeholder="User Id" name ="user" required>
<input type="password" class="input-field" placeholder="Enter Password" name="password" required>
<input type="checkbox" class="check-box"><span>Remember Password</span>
<button type="submit" class="submit-btn">Sign-In</button>
</form>
And then in PHP to "catch" the data from the post, you'll use something like this:
$this->getpost['user'];
Or
$_POST['user'];
The method attribute specifies how to send form-data (the form-data is sent to the page specified in the action attribute).
The form-data can be sent as URL variables (with method="get") or as HTTP post transaction (with method="post").
check here for more details w3schools
<form id="login" class="input-group" method="POST" action="file_path/login.php">
<input type="text" class="input-field" placeholder="User Id" required>
<input type="password" class="input-field" placeholder="Enter Password" required>
<input type="checkbox" class="check-box"><span>Remember Password</span>
<input type="submit" class="submit-btn" value="Sign-In">
</form>
<form Id="register" class="input-group" method="POST" action="file_path/register.php">
<input type="text" class="input-field" placeholder="User Id" required>
<input type="email" class="input-field" placeholder="Email Id" required>
<input type="password" class="input-field" placeholder="Enter Password" required>
<input type="password" class="input-field" placeholder="Confirm Password" required>
<input type="phone-number" class="input-field" placeholder="Mobile Number" required>
<input type="checkbox" class="check-box"><span>I agree to the terms & conditions</span>
<input type="submit" class="submit-btn" value="Sign-Up">
</form>
EDIT according to your comment
replace button with input type="submit"
and place # before the php variable so you wont get undefined error notice(# is used to avoid error notice)
<div class="header">
<h2>Register here</h2>
</div>
<form method="post" action="register.php">
<?php include('errors.php'); ?>
<div class="input-group">
<label>Username</label>
<input type="text" name="username" value="<?php echo #$username; ?>">
</div>
<div class="input-group">
<label>Email</label>
<input type="email" name="email" value="<?php echo #$email; ?>">
</div>
<div class="input-group">
<label>Password</label>
<input type="password" name="password_1">
</div>
<div class="input-group">
<label>Confirm Password</label>
<input type="password" name="password_2">
</div>
<div class="input-group">
<label>Mobile number</label>
<input type="number" name="mobile" value="<?php echo #$mobile; ?>">
</div>
<div class="input-group">
<input type="submit" class="btn" name="reg_user" value="Sign-Up">
</div>
</form>
create register.php file
and in register.php
<?php
$con = mysqli_connect("localhost", "username", "password", "dbname") or trigger_error("Unable to connect to the database");
if(isset($_POST['reg_user'])){
$name = $_POST['username']; //here "username" is what you defined in the "name" field of input form
//define other variables
//write your own sql query , here is an example
$query = "INSERT INTO table(name) VALUES(?)";
$stmt = mysqli_stmt_init($con);
if(!mysqli_stmt_prepare($stmt,$query)){
echo "Error";
}else{
mysqli_stmt_bind_param($stmt,"s",$name);
mysqli_stmt_execute($stmt);
}
}
?>

Dynamically change html Login form to Registration form

I have a login form that takes input for user credentials. At the bottom I have a link to a Register user form. It takes me to a whole new page to register a user. However is there a way with JQuery AJAX to change the login form inputs to take registration inputs instead and send to the respective correct processing php files?
My form for login:
<div id="backgroundLogin">
<form name="login" method="post" action="./Login.php">
<fieldset>
<p id="title">
Connect-a-Cutie Login
</p>
<p id="email">
<label> Email:</label>
<input type="text" name="email" placeholder="Type your email...">
</p>
<p id="password">
<label>Password:</label>
<input type="text" name="password" placeholder="Type your password...">
</p>
<button href="./LoginPage.php" type="submit">Submit!</button>
<p>
<p>Not yet a member? Register now!</p>
</fieldset>
</form>
</div>
And my registration form:
<form action="RegistrationPage.php" method="POST">
Name: <input type="text" name="name" placeholder="Enter your name..."/><br/>
Email: <input type="text" name="email" placeholder="Enter your email..."/><br/>
Password: <input type="text" name="password" placeholder="Enter your password..."/> (make sure no one is looking...)<br/>
Addess: <input type="text" name="address" placeholder="Enter your address..."/><br/>
Do you want to be an admin? <input type="text" name="isAdmin" placeholder="TRUE or FALSE"/><br/><br/>
<button type="submit">Submit</button>
</form>
You can use the method of hiding one of the forms.
$("#switchForm").click(function(){
const isLoginVisible = $("#login_form").is(':not(:hidden)');
if(isLoginVisible) {
$("#login_form").hide();
$("#register_form").show();
$("#switchForm > p").html("Already member? Login now!");
} else {
$("#login_form").show();
$("#register_form").hide();
$("#switchForm > p").html("Not yet a member? Register now!");
}
})
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="backgroundLogin">
<fieldset>
<form id="login_form" name="login" method="post" action="./Login.php">
<p id="title">
Connect-a-Cutie Login
</p>
<p id="email">
<label> Email:</label>
<input type="text" name="email" placeholder="Type your email...">
</p>
<p id="password">
<label>Password:</label>
<input type="text" name="password" placeholder="Type your password...">
</p>
<button href="./LoginPage.php" type="submit">Submit!</button>
<p>
</form>
<form id="register_form" action="RegistrationPage.php" method="POST" style="display: none;">
Name: <input type="text" name="name" placeholder="Enter your name..."/><br/>
Email: <input type="text" name="email" placeholder="Enter your email..."/><br/>
Password: <input type="text" name="password" placeholder="Enter your password..."/> (make sure no one is looking...)<br/>
Addess: <input type="text" name="address" placeholder="Enter your address..."/><br/>
Do you want to be an admin? <input type="text" name="isAdmin" placeholder="TRUE or FALSE"/><br/><br/>
<button type="submit">Submit</button>
</form>
<a id="switchForm" href="#">
<p>Not yet a member? Register now!</p></a>
</fieldset>
</div>
I think that it will meet your expectations.
Try this! :)
$('.login-form a.show-register-form').click(function(){
$('.login-form').hide();
$('.register-form').show();
});
$('.register-form a.show-login-form').click(function(){
$('.register-form').hide();
$('.login-form').show();
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="backgroundLogin">
<form name="login" method="post" action="./Login.php" class="login-form">
<fieldset>
<p id="title">
Connect-a-Cutie Login
</p>
<p id="email">
<label> Email:</label>
<input type="text" name="email" placeholder="Type your email...">
</p>
<p id="password">
<label>Password:</label>
<input type="text" name="password" placeholder="Type your password...">
</p>
<button href="./LoginPage.php" type="submit">Submit!</button>
<p>
<p>Not yet a member? Register now!</p>
</fieldset>
</form>
<form action="RegistrationPage.php" method="POST" class="register-form" style="display:none;">
Name: <input type="text" name="name" placeholder="Enter your name..."/><br/>
Email: <input type="text" name="email" placeholder="Enter your email..."/><br/>
Password: <input type="text" name="password" placeholder="Enter your password..."/> (make sure no one is looking...)<br/>
Addess: <input type="text" name="address" placeholder="Enter your address..."/><br/>
Do you want to be an admin? <input type="text" name="isAdmin" placeholder="TRUE or FALSE"/><br/>
<button type="submit">Submit</button>
<p>have user?, login here!</p>
</form>
</div>

Submit button not working. No action is taken when i click on the create account button

This is the form on whic i'm working. i want it to send the data to 1.php but when i click on the create account button. please tell what is wrong with this code.
<div class="logmod__form">
<form accept-charset="utf-8" action="1.php" class="simform" method="post">
<div class="sminputs">
<div class="input full">
<label class="string optional" for="user-name">Email*</label>
<input class="string optional" maxlength="255" id="user-email" placeholder="Email" type="email" size="50" />
</div>
</div>
<div class="sminputs">
<div class="input string optional">
<label class="string optional" for="user-pw">Password *</label>
<input class="string optional" maxlength="255" id="user-pw" placeholder="Password" type="text" size="50" />
</div>
<div class="input string optional">
<label class="string optional" for="user-pw-repeat">Repeat password *</label>
<input class="string optional" maxlength="255" id="user-pw-repeat" placeholder="Repeat password" type="text" size="50" />
</div>
</div>
<div class="simform__actions">
<input class="sumbit" name="commit" type="sumbit" value="Create Account" />
<span class="simform__actions-sidetext">By creating an account you agree to our <a class="special" href="#" target="_blank" role="link">Terms & Privacy</a></span> </div>
</form>
</div>
Correct it in your button
type="submit"
You missed name Attribute in your fields without it nothing is submitted
<input class="string optional" maxlength="255" id="user-pw-repeat" placeholder="Repeat password" type="text" size="50" name="user-pw-repeat"/>

Contact form with Bootstrap + Php not working

I am a beginner and I am trying to use this tutoriel http://untame.net/2013/05/how-to-build-a-modal-contact-form-in-twitter-bootstrap-with-php-ajax for creating my contact form. Email not sending ! Do you have an idea, why ? Thanks for your help !
After clicking on Send I have this on adresse web : http://viktorius.fr/?question=&email=&save=contact
Here the HTML code :
<div style="margin-bottom: 25px" class="input-group">
<span class="input-group-addon"><img src="img/glyphicons_012_heart.png"></span>
<input id="login-username" type="text" class="form-control" name="username" value="" placeholder="What is your question ?">
</div>
<h5 id="Email" align="left" color="#000"<span style="color:black">For the answer, let us your email :</h5>
<div style="margin-bottom: 25px" class="input-group">
<span class="input-group-addon"><img src="img/glyphicons_290_skull.png"></span></span>
<input id="login-username" type="text" class="form-control" name="username" value="" placeholder="Email">
</div>
<!-- Form itself -->
<div class="form-actions">
<input type="hidden" name="save" value="contact">
<button type="submit" class="btn btn-primary pull-right">Send</button><br />
Here the PHP code :
<?php
ini_set(“SMTP”,”smtp.viktorius.fr”);
ini_set(“smtp_port”,”25″);
$myemail = 'postmaster#viktorius.fr';
if (isset($_POST['question'])) {
$email = strip_tags($_POST['email']);
echo "<span class=\"alert alert-success\" >Your message has been received. Thanks! Here is what you submitted:</span><br><br>";
echo "<stong>Question:</strong> ".$question."<br>";
echo "<stong>Email:</strong> ".$email."<br>";
if (isset($_POST['name']))
<input id="login-username" type="text" class="form-control" name="username" value="" placeholder="What is your question ?">
Check the name of your inputs, php cant read your post data.
There is not a single form here...
the ajax expects to serialize
<form class="contact">...
$('form.contact').serialize(),
And you don't have a form
You should put all your inputs and button inside a form tag with class contact like this:
<form action="" class="contact">
<div style="margin-bottom: 25px" class="input-group">
<span class="input-group-addon"><img src="img/glyphicons_012_heart.png"></span>
<input id="login-username" type="text" class="form-control" name="username" value="" placeholder="What is your question ?">
</div>
<div style="margin-bottom: 25px;" class="input-group">
<span class="input-group-addon"><img src="img/glyphicons_290_skull.png"></span>
<input id="login-username" type="text" class="form-control" name="username" value="" color="#000000"placeholder="For the answer, let us your email adress here :">
</div>
<div class="form-actions">
<input type="hidden" name="save" value="contact">
<button type="submit" class="btn btn-primary pull-right">Send</button><br>
</div>
</form>

Categories