save me

<?php
/**
Template Name: Fourm
*/
get_header();
?>

<div id=”primary” class=”content-area”>
<main class=”site-main”>

<script>
jQuery(function() {
jQuery(‘form#ff’).on(‘submit’, function(e) {
jQuery.ajax({
type: ‘post’,
url: ‘dashbord.php’,
data: jQuery(this).serialize(),
success: function(o) {

alert(‘MUST ALERT TO DETERMINE SUCCESS PAGE’);
}
});
e.preventDefault();
});
});
</script>
<form id=”ff” method=”post” action=””>
First name:<br>
<input type=”text” name=”firstname”>
<br>
Last name:<br>
<input type=”text” name=”lastname”>
<br>
Email:<br>
<input type=”text” name=”email”>
<br>
Compny name<br>
<input type=”text” name=”cname”>
<br>
Compny grade<br>
<input type=”text” name=”cgrade”>
<br>
<input type=”submit” name=”submit”>
<?php
if (isset($_POST[‘submit’])) {

$fname = $_POST[‘firstname’];
$lname = $_POST[‘lastname’];
$email = $_POST[’email’];
$cname = $_POST[‘cname’];
$cgrade = $_POST[‘cgrade’];

$wpdb->insert(
’employe’, array(
‘fname’ => $fname,
‘lname’ => $lname,
’email’ => $email
));
$wpdb->insert(
‘compny’, array(
‘compnyname’ => $cname,
‘compnygrade’ => $cgrade
)
);
}
?>
</form>

<?php
$result = $wpdb->get_results(“SELECT * FROM employe”);
echo ‘<table>’;
foreach ($result as $print) {
echo ‘<tr>’;
echo ‘<td>’ . $print->fname . ‘</td>’;
echo ‘<td>’ . $print->lname . ‘</td>’;
echo ‘<td>’ . $print->email . ‘</td>’;
//echo ‘<td>’.$print->compnyname.'</td>’;
//echo ‘<td>’.$print->compnygrade.'</td>’;
echo ‘<tr>’;
}
echo ‘</table>’;
?>

<script type=’text/javascript’>

</script>

<?php //include_once(‘dashbord.php’); ?>
</main><!– .site-main –>
</div><!– .content-area –>

<?php get_footer(); ?>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: