data not inserting in to the mysql database
-
<?php
/*
template name: contact form
*/
//require_once(‘/wp-config.php’);
?><div class=”wrap”>
<form action=”” method=”post” align=”center”>
<label for=”fname”>First Name:</label> <input type=”text” name=”fname” value=”” id=”fname”>
<label for=”lname”>Last Name:</label><input type=”text” name=”lname” value=”” id=”lname”><label for=”password”>Password:</label><input type=”password” name=”password” value=”” id=”password”>
<label for=”cpassword”>Confirm Password:</label><input type=”password” name=”cpassword” value=”” id=”cpassword”>
<label for=”email”>Email:</label><input type=”email” name=”email” value=”” id=”email”>
<label for=”submit”></label><input type=”submit” name=”submit” value=”submit Here” id=”submit”>
</form>
</div>
<?php
global $wpdb;
global $fname,$lname,$Password,$email;
$fname = $_POST[‘fname’];
$lname = $_POST[‘lname’];
$email = $_POST[’email’];
$password = $_POST[‘password’];
if (isset($_POST[‘submit’])) {
echo $table_name = $wpdb->prefix . “register”;
if($wpdb->insert($table_name,
array(‘fname’ => $fname,
‘lname’ => $lname,
‘Password’ => $Password,
’email’ => $email))
) {
echo “success”;
} else {
ECHO “NOT”;
}
}
?>
- The topic ‘data not inserting in to the mysql database’ is closed to new replies.