</div>
<div class="row block-9">
<div class="col-md-6 order-md-last d-flex">
<form action="#" class="bg-white p-5 contact-form">
<form class="=contact-form" action="contact.php" method="post"
<div class="form-group">
<input type="text" class="form-control" placeholder="Your Name">
</div>
<div class="form-group">
<input type="text" class="form-control" placeholder="Your Email">
</div>
<div class="form-group">
<input type="text" class="form-control" placeholder="Subject">
</div>
<div class="form-group">
<textarea name="" id="" cols="30" rows="7" class="form-control" placeholder="Message"></textarea>
</div>
<div class="form-group">
<input type="submit" value="Send Message" class="btn btn-primary py-3 px-5">
</div>
</form>
</div>
<div class="col-md-6 d-flex">
<iframe src="https://www.google.com/maps/embed?pb=!1m14!1m8!1m3!1d14884.226370030301!2d79.103842!3d21.150146!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x0%3A0x5106808b025223d!2sRajshri%20Traders!5e0!3m2!1sen!2sid!4v1566792666441!5m2!1sen!2sid" width="600" height="450" frameborder="0" style="border:0;" allowfullscreen=""></iframe>
</div>
</div>
</div>
</section>
<footer class="ftco-footer ftco-section">
<div class="container">
<div class="row">
<div class="mouse">
<a href="#" class="mouse-icon">
<div class="mouse-wheel"><span class="ion-ios-arrow-up"></span></div>
</a>
</div>
</div>
<div class="row mb-5">
<div class="col-md">
<div class="ftco-footer-widget mb-4">
<h2 class="ftco-heading-2">Rajshri Traders</h2>
<p>We provide the best Cctvs.</p>
<ul class="ftco-footer-social list-unstyled float-md-left float-lft mt-5">
<li class="ftco-animate"><span class="icon-twitter"></span></li>
<li class="ftco-animate"><span class="icon-facebook"></span></li>
<li class="ftco-animate"><span class="icon-instagram"></span></li>
</ul>
</div>
</div>
<div class="col-md">
<div class="ftco-footer-widget mb-4 ml-md-5">
<h2 class="ftco-heading-2">Menu</h2>
<ul class="list-unstyled">
<li>Shop</li>
<li>About</li>
<li> </li>
<li> </li>
</ul>
</div>
</div>
<div class="col-md-4">
<div class="ftco-footer-widget mb-4">
<h2 class="ftco-heading-2"> </h2>
<div class="d-flex">
<ul class="list-unstyled mr-l-5 pr-l-3 mr-4">
<li> </li>
<li> </li>
<li> </li>
<li> </li>
</ul>
<ul class="list-unstyled">
<li> </li>
<li> </li>
</ul>
</div>
</div>
</div>
<div class="col-md">
<div class="ftco-footer-widget mb-4">
<h2 class="ftco-heading-2">Have a Questions?</h2>
<div class="block-23 mb-3">
<ul>
<li><span class="icon icon-map-marker"></span><span class="text">Plot No 1, Nike buildings, Fawara Chouk,Gandhibag, Nagpur, Maharashtra 440032, India</span></li>
<li><span class="icon icon-envelope"></span><span class="text"> rajshirtraders#gmail.com</span></li>
</ul>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12 text-center">
</div>
</div>
</div>
</footer>
<!-- loader -->
<div id="ftco-loader" class="show fullscreen"><svg class="circular" width="48px" height="48px"><circle class="path-bg" cx="24" cy="24" r="22" fill="none" stroke-width="4" stroke="#eeeeee"/><circle class="path" cx="24" cy="24" r="22" fill="none" stroke-width="4" stroke-miterlimit="10" stroke="#F96D00"/></svg></div>
i am trying to link my php to the contact form but facing some issues please help
the format of the cotact us is also a bit messed up after sevral attempts to fix it i coudnt
i am using my sql for the php
i have the php file but dont know where to attach it in the contact us page (html)
i have tried a few solutions looking at youtube
but nothing works
please help
That's how work php/html:
HTML
<form class="=contact-form" action="contact.php" method="post">
<div class="form-group">
<input type="text" class="form-control" placeholder="Your Name" name="name">
</div>
<div class="form-group">
<input type="text" class="form-control" placeholder="Your Email" name="email">
</div>
<div class="form-group">
<input type="text" class="form-control" placeholder="Subject" name="subject">
</div>
<div class="form-group">
<textarea name="mess" id="" cols="30" rows="7" class="form-control" placeholder="Message" ></textarea>
</div>
<div class="form-group">
<input type="submit" value="Send Message" class="btn btn-primary py-3 px-5">
</div>
</form>
Here user will input data and sent to contact.php, i add name="" and we will create a variable with that.
PHP
// ALL VARIABLE FROM FORM
$name=$_POST['name'];
$email=$_POST['email'];
$subject=$_POST['subject'];
$message=$_POST['message'];
//NOW YOU CAN SENT EMAIL
$to = "somebody#example.com";
$headers = "From:".$email . "\r\n" .
"CC: somebodyelse#example.com";
mail($to,$subject,$message,$headers);
Related
<form id=reg_form action="includes/data.inc.php" method="POST">
<div class="login-modal-right">
<!-- Login Form -->
<div class="tab-content">
<div class="tab-pane active" id="login" role="tabpanel">
<h5 class="heading-design-h5">Login to your account</h5>
<fieldset class="form-group">
<label>Enter Email/Mobile number</label>
<input type="text" name="email_num" class="form-control" placeholder="123 456 7890" required>
</fieldset>
<fieldset class="form-group">
<label>Enter Password</label>
<input type="password" name="password" class="form-control" placeholder="********" required>
</fieldset>
<fieldset class="form-group">
<button type="submit" name="login-submit" class="btn btn-lg btn-secondary btn-block">Enter My Account</button>
</fieldset>
</div>
<!-- Register Form -->
<div class="tab-pane" id="register" role="tabpanel">
<h5 class="heading-design-h5">Register Now!</h5>
<fieldset class="form-group">
<label for="reg-name">Full Name</label>
<input type="text" name="fullname" id="reg-name" class="form-control" placeholder="Your Full Name" required>
</fieldset>
<p id="namechk"></p>
<fieldset class="form-group">
<label for="reg-email">Enter Email</label>
<input type="email" name="email" id="reg-email" class="form-control" placeholder="example#gmail.com" required>
</fieldset>
<p id="emailchk"></p>
<fieldset class="form-group">
<label for="reg-num">Enter Mobile Number</label>
<input type="text" name="number" id="reg-num" class="form-control" placeholder="123 456 7890" required>
</fieldset>
<p id="numchk"></p>
<fieldset class="form-group">
<label for="reg-pass">Enter Password</label>
<input type="password" name="pass" id="reg-pass" class="form-control" placeholder="********" required>
</fieldset>
<p id="passchk"></p>
<!-- <div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input">
<label class="custom-control-label" for="customCheck2">I Agree with Term and Conditions</label>
</div> -->
<fieldset class="form-group">
<input type="submit" id="reg-sub" value="Create Your Account" class="btn btn-lg btn-secondary btn-block" role="button">
</fieldset>
</div>
</div>
<div class="clearfix"></div>
<div class="text-center login-footer-tab">
<ul class="nav nav-tabs" role="tablist">
<li class="nav-item">
<a class="nav-link active" data-toggle="tab" href="#login" role="tab"><i class="mdi mdi-lock"></i> LOGIN</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#register" role="tab"><i class="mdi mdi-pencil"></i> REGISTER</a>
</li>
</ul>
</div>
<div class="clearfix"></div>
</div>
</form>
The Problem Is I can only set an action for any one form. Let say if I set the action for the registration form then where or how I can set the action for the login form. I have even tried separating them, but it actually breaks the design. If anyone can resolve it with design (Just in case if I did any error) then you are most welcome. Or if there's any way I can set action for both of them separately. I do tried manipulating both of them from the same page(action page) but again it doesn't work.
Put separate form tag for each tab
<div class="tab-pane active" id="login" role="tabpanel">
<form>
</form>
</div>
<div class="tab-pane" id="register" role="tabpanel">
<form>
</form>
</div>
I'm using Bootstrap 4 and I've created a two pane form; registration and sign in forms.
I know using AJAX is more suitable for such situations that it won't make the page refresh, however, I'm asking if there is any way of achieving that the page refreshes and previews the same pane using only PHP.
Using PHP in the code. Is there any way that when I submit the form when in registration pane (the one on the right hand side), the page refreshes and stays in the same pane.
<!-- Tabs -->
<nav class="register-nav">
<div class="nav nav-tabs nav-justified" id="nav-tab" role="tablist">
<a class="nav-item nav-link active" id="nav-signin-tab" data-toggle="tab" href="#nav-signin" role="tab">Sign in</a>
<a class="nav-item nav-link" id="nav-signup-tab" data-toggle="tab" href="#nav-signup" role="tab">Create New Account</a>
</div>
</nav>
<!-- Content of Tabs -->
<div class="tab-content" id="nav-tabContent">
<!-- Sign in Tab Pane -->
<div class="tab-pane fade show active" id="nav-signin" role="tabpanel">
<form action="" method="POST">
<div class="form-group">
<div class="row">
<div class="col-sm-6">
<a class="btn btn-block btn-social btn-facebook">
<span class="fa fa-facebook"></span> Sign in with Facebook
</a>
</div>
<div class="col-sm-6">
<a class="btn btn-block btn-social btn-google">
<span class="fa fa-google"></span> Sign in with Google
</a>
</div>
</div>
</div>
<div class="form-group">
<input type="text" class="form-control" placeholder="Username / Email Address">
</div>
<div class="form-group">
<input type="password" class="form-control" placeholder="Password">
</div>
<div class="form-group text-center mt-5">
<input type="submit" class="btn btn-outline-info" value="Sign in">
</div>
</form>
</div>
<!-- Sign Up Tab Pane -->
<div class="tab-pane fade" id="nav-signup" role="tabpanel">
<form action="" method="POST">
<div class="form-group">
<input type="text" class="form-control" placeholder="First name" required>
</div>
<div class="form-group">
<input type="text" class="form-control" placeholder="Last name" required>
</div>
<div class="form-group">
<input type="text" class="form-control" placeholder="Username" required>
</div>
<div class="form-group">
<input type="email" class="form-control" placeholder="Email Address" required>
</div>
<div class="form-group">
<input type="password" class="form-control" placeholder="Password" required>
</div>
<div class="form-group">
<input type="password" class="form-control" placeholder="Confirm Password" required>
</div>
<div class="form-check">
<input type="checkbox" class="form-check-input" required>
<label class="form-check-label">By registering to
velocity, you agree to its
terms and conditions
</label>
</div>
<div class="form-group text-center mt-5">
<input id="register-btn" type="submit" class="btn btn-outline-success" value="Register" disabled>
</div>
</form>
</div>
</div>
It is really not a PHP thing, but you could use PHP to manipulate the HTML to move the active class to the other tab.
<?php
$signinTabIsActive = "active";
$signupTabIsActive = "";
if(isset($_POST['firstname'])){
$signinTabIsActive = "";
$signupTabIsActive = "active";
?>
<!-- Tabs -->
<nav class="register-nav">
<div class="nav nav-tabs nav-justified" id="nav-tab" role="tablist">
<a class="nav-item nav-link <?= $signinTabIsActive; ?>" id="nav-signin-tab" data-toggle="tab" href="#nav-signin" role="tab">Sign in</a>
<a class="nav-item nav-link <?= $signupTabIsActive; ?>" id="nav-signup-tab" data-toggle="tab" href="#nav-signup" role="tab">Create New Account</a>
</div>
</nav>
Add a hidden input with a value that indicaties which pane should open. When generating the form (with Php) decide which pane gets an active class based on this value in the $_POST array
I am trying to develop a comment and reply system.
First I fetch all the comments from the database and display it in div with class="comment" . and I set a Reply button for each comment .
Now what I want is if the button is clicked
a reply form should appear .
currently reply form div is set to display:"none"
<div class="row col-md-12"><!--reply system starts here -->
<!--reply form goes here -->
</div>
Below is the whole html
<?php foreach ($comment_res as $comments){ ?>
<div class="comment">
<div class="col-md-12">
<h5>
<?php echo $comments['vname'] ?> <small><button class="replybtn" id="<?php echo $comments['comment_id']; ?>">Reply</button></small></h5>
</div>
<div class="col-md-3"><img src="admin/member_profile/commenter_icon.png" alt="photo" width="50"></div>
<div class="col-md-6 text_indent">
<?php echo $comments['comment'] ?>
</div>
<!--
<div class="comment col-xs-offset-1">
<div class="col-md-12"><h5>Pankaj</h5></div>
<div class="col-md-3"><img src="admin/member_profile/commenter_icon.png" alt="photo" width="40"></div>
<div class="col-md-9 text_indent">kya hai be</div>
</div>-->
<!--//-->
<div class="row col-md-12">
<!--reply system starts here-->
<!--reply form goes here -->
</div>
<!--//-->
</div>
<?php } ?>
So Simple in your loop, and in the hidden form section , set a class for a form by example <form class="reply_form" ...> , then you have just to set a jquery event to the button so it goes into comment parent div (.parents([.selector])) then search for the current form using the its class (.find( selector )) and show() it :
I tried to reproduce the genrated loop code in the below snippet :
$('.replybtn').on("click", function() {
$(this).parents(".comment").find(".reply_form").show();
});
.reply_form {
display: none;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<div class="container">
<div class="comment">
<div class="col-md-12">
<h5>
Commenter <small><button class="replybtn" id="<?php echo $comments['comment_id']; ?>">Reply</button></small></h5>
</div>
<div class="col-md-3"><img src="http://icons.iconarchive.com/icons/graphicloads/flat-finance/256/person-icon.png" alt="photo" width="50"></div>
<div class="col-md-6 text_indent">
the comment
</div>
<!--
<div class="comment col-xs-offset-1">
<div class="col-md-12"><h5>Pankaj</h5></div>
<div class="col-md-3"><img src="admin/member_profile/commenter_icon.png" alt="photo" width="40"></div>
<div class="col-md-9 text_indent">kya hai be</div>
</div>-->
<!--//-->
<div class="row col-md-12">
<form action="#" class="reply_form">
<div class="form-group">
<label for="name">Name </label>
<input id="name" type="text" name="name" class="form-control">
</div>
<div class="form-group">
<label for="comment">Comment </label>
<textarea id="comment" name="comment" class="form-control"></textarea>
</div>
<div>
<button type="button" class="btn btn-primary ">Submit</button>
</div>
</form>
</div>
<!--//-->
</div>
<div class="comment">
<div class="col-md-12">
<h5>
Commenter 2 <small><button class="replybtn" id="<?php echo $comments['comment_id']; ?>">Reply</button></small></h5>
</div>
<div class="col-md-3"><img src="http://icons.iconarchive.com/icons/graphicloads/flat-finance/256/person-icon.png" alt="photo" width="50"></div>
<div class="col-md-6 text_indent">
the comment
</div>
<!--
<div class="comment col-xs-offset-1">
<div class="col-md-12"><h5>Pankaj</h5></div>
<div class="col-md-3"><img src="admin/member_profile/commenter_icon.png" alt="photo" width="40"></div>
<div class="col-md-9 text_indent">kya hai be</div>
</div>-->
<!--//-->
<div class="row col-md-12">
<form action="#" class="reply_form">
<div class="form-group">
<label for="name">Name </label>
<input id="name" type="text" name="name" class="form-control">
</div>
<div class="form-group">
<label for="comment">Comment </label>
<textarea id="comment" name="comment" class="form-control"></textarea>
</div>
<div>
<button type="button" class="btn btn-primary ">Submit</button>
</div>
</form>
</div>
<!--//-->
</div>
<div class="comment">
<div class="col-md-12">
<h5>
Commenter 3 <small><button class="replybtn" id="<?php echo $comments['comment_id']; ?>">Reply</button></small></h5>
</div>
<div class="col-md-3"><img src="http://icons.iconarchive.com/icons/graphicloads/flat-finance/256/person-icon.png" alt="photo" width="50"></div>
<div class="col-md-6 text_indent">
the comment
</div>
<!--
<div class="comment col-xs-offset-1">
<div class="col-md-12"><h5>Pankaj</h5></div>
<div class="col-md-3"><img src="admin/member_profile/commenter_icon.png" alt="photo" width="40"></div>
<div class="col-md-9 text_indent">kya hai be</div>
</div>-->
<!--//-->
<div class="row col-md-12">
<form action="#" class="reply_form">
<div class="form-group">
<label for="name">Name </label>
<input id="name" type="text" name="name" class="form-control">
</div>
<div class="form-group">
<label for="comment">Comment </label>
<textarea id="comment" name="comment" class="form-control"></textarea>
</div>
<div>
<button type="button" class="btn btn-primary ">Submit</button>
</div>
</form>
</div>
<!--//-->
</div>
</div>
<!-- /container -->
What you have to do, if your reply form is individual for every comment
Make Reply div display:none default
On click event of button just you have to make display:block of that reply form
Have a look updated code,
<?php foreach ($comment_res as $comments) { ?>
<div class="comment">
<div class="col-md-12"><h5><?php echo $comments['vname'] ?> <small><button class="replybtn" id="<?php echo $comments['comment_id']; ?>">Reply</button></small></h5></div>
<div class="col-md-3"><img src="admin/member_profile/commenter_icon.png" alt="photo" width="50"></div>
<div class="col-md-6 text_indent"><?php echo $comments['comment'] ?></div>
<!--
<div class="comment col-xs-offset-1">
<div class="col-md-12"><h5>Pankaj</h5></div>
<div class="col-md-3"><img src="admin/member_profile/commenter_icon.png" alt="photo" width="40"></div>
<div class="col-md-9 text_indent">kya hai be</div>
</div>-->
<!--//-->
<div class="row col-md-12 replyform-<?php echo $comments['comment_id']; ?>" style="display: none;"><!--reply system starts here-->
<!--reply form goes here -->
</div>
<!--//-->
</div>
<?php } ?>
<script>
jQuery(document).on("click", ".replybtn", function () {
var comment_id = jQuery(this).attr("id");
jQuery(this).parents(".comment").find(".replyform-" + comment_id).css({display: "block"});
});
</script>
$('.replybtn').click(function () {
$('#reply_form').show()
});
Where #reply_form - form to reply
You can do This using Jquery hide() and show() function like below.
$('.replybtn').click(function () {
$('#comment_form').show()
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
<div class="comment">
<div class="col-md-12">
<h5>
<small>
<button class="replybtn">Reply</button>
</small>
</h5>
</div>
<div class="col-md-3">
<img src="admin/member_profile/commenter_icon.png" alt="photo" width="50">
</div>
<div class="col-md-6 text_indent"></div>
<div class="row col-md-12" id="comment_form" style="display:none">
<div class="form-group">
<label for="form_lastname">Name *</label>
<input id="form_lastname" type="text" name="surname" class="form-control" placeholder="Please enter your lastname *" required="required" data-error="Lastname is required.">
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
<label for="form_email">Email *</label>
<input id="form_email" type="email" name="email" class="form-control" placeholder="Please enter your email *" required="required" data-error="Valid email is required.">
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
<label for="form_message">Message *</label>
<textarea id="form_message" name="message" class="form-control" placeholder="Message for me *" rows="4" required="required" data-error="Please,leave us a message."></textarea>
<div class="help-block with-errors"></div>
</div>
</div>
</div>
<?php
$comment_res['comment_res'] = array(
'vname'=>'sggsgsgsg',
'comment_id'=>10,
'comment'=>'sgsdgsgdsgsg'
);
foreach ($comment_res as $comments){ ?>
<div class="comment">
<div class="col-md-12"><h5><?php echo $comments['vname'] ?> <small><button class="replybtn" id="<?php echo $comments['comment_id']; ?>" data-target="#commentQue_<?php echo $comments['comment_id'];?>">Reply</button></small></h5></div>
<div class="col-md-3"><img src="admin/member_profile/commenter_icon.png" alt="photo" width="50"></div>
<div class="col-md-6 text_indent"><?php echo $comments['comment'] ?></div>
<div class="modal fade commentQueModal" id="commentQue_<?php echo $comments['comment_id']; ?>" tabindex="-1" role="dialog" aria-labelledby="commentQueLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<div class="suceess_container">
<h4 class="suceess_msg" id="suceess_msg_comment"></h4>
<h4 class="error_msg" id="error_msg_comment"></h4>
</div>
</div>
<form class="commentQueform" id="commentQueform"></form>
<div class="modal-body">
<div class="form-group">
<label>Comment</label>
<input type="text" name="followup_comment" id="followup_comment" class="form-control">
<div class="error_msg_int" id="error_msg_followup_comment"></div>
</div>
<input type="hidden" name="que_id" id="que_id" value="<?php echo $que_det['id']; ?>">
<input type="hidden" name="follow_que_id" id="follow_que_id" value="<?php echo $followup_que_det['id']; ?>">
</div>
<div class="modal-footer">
<button id="comment_que_<?php echo $followup_que_det['id']; ?>_<?php echo $que_det['id'] ?>" name="comment_que" value="Submit" class="btn btn-primary">Submit</button>
</div>
</form>
</div>
</div>
</div>
</div>
<?php } ?>
NOW you have to hide this texbox and when any user hit button reply and with the help of ajax we can store it in to the database.
I have created a PHP form and i want to add Data on my SQL
Please check my Code where is the Issue whay not working my Code
I want to add all this field on my PHPadmin
but when i enter details and click on Make a payment its not working
i also add form action="insert.php"
Here is Code
<div class="agileits_main_grid_right">
<div class="wthree_payment_grid">
<h2>Seleccione Método de pago</h2>
<div id="horizontalTab">
<ul class="resp-tabs-list">
<li><img src="images/1.jpg" alt=" " /></li>
<li><img src="images/2.jpg" alt=" " /></li>
</ul>
<div class="resp-tabs-container">
<div class="agileits_w3layouts_tab1">
<form action="insert.php" method="post" class="creditly-card-form agileinfo_form">
<section class="creditly-wrapper wthree, w3_agileits_wrapper">
<div class="credit-card-wrapper">
<div class="first-row form-group">
<div class="controls">
<label class="control-label">Name on Card</label>
<input class="billing-address-name form-control" type="text" name="name" placeholder="John Smith">
</div>
<div class="w3_agileits_card_number_grids">
<div class="w3_agileits_card_number_grid_left">
<div class="controls">
<label class="control-label">Card Number</label>
<input class="number credit-card-number form-control" type="text" name="number"
inputmode="numeric" autocomplete="cc-number" autocompletetype="cc-number" x-autocompletetype="cc-number"
placeholder=" ">
</div>
</div>
<div class="w3_agileits_card_number_grid_right">
<div class="controls">
<label class="control-label">CVV</label>
<input class="security-code form-control"·
inputmode="numeric"
type="text" name="security-code"
placeholder="">
</div>
</div>
<div class="clear"> </div>
</div>
<div class="controls">
<label class="control-label">Expiration Date</label>
<input class="expiration-month-and-year form-control" type="text" name="expiration-month-and-year" placeholder="MM / YY">
</div>
</div>
<button class="submit"><span>Make a payment <i class="fa fa-long-arrow-right" aria-hidden="true"></i></span></button>
</div>
</section>
</form>
</div>
I'm hoping one of you experts can point out the error in my code for my database connection in my PHP. My page wont work at all.
I'm trying to create new users into my database. I've checked all the names in my table and they match up perfectly.
Here is my function:
<?php include('connection.php'); ?>
<?php
function createUser()
{
if(isset($_POST['submit']))
{
global $connection;
$username = $_POST['username'];
$password = $_POST['password'];
$firstName = $_POST['firstName'];
$lastName = $_POST['lastName'];
$emailAddress = $_POST['emailAddress'];
$phoneNumber = $_POST['phoneNumber'];
$privilege = $_POST['privilege'];
$query = "INSERT INTO users(username,password,firstName,lastName,emailAddress,phoneNumber,privilege)";
$query .= "VALUES ('$username', '$password','$firstName','$lastName','$emailAddress','$phoneNumber','$privilege')";
$result = mysqli_query($connection, $query);
if(!$result)
{
die('Query Failed' . mysqli_error());
}
else
{
echo '<div class="modal-footer">
<div class="alert alert-success alert-block fade in" id="successAlert">
<button class="close" type="button" data-dismiss="alert" aria-label="close"><span aria-hidden="true">×</span></button>
<h4>Success!</h4>
<p>New user registered successfully</p>
</div>
</div>';
die;
}
}
}
?>
Here is my HTML:
I call the header.php into my home page but the functions are also called on in there.
<?php include('connection.php'); ?>
<?php include('functions.php'); ?>
<?php createUser(); ?>
<!DOCTYPE html>
<html lang="en">
<head>
</head>
<body>
<div class="navbar navbar-fixed-top navbar-inverse">
<div class="container">
<button class="navbar-toggle" data-target=".navbar-responsive-collapse" data-toggle="collapse" type="button">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<!-- end responsive-dropdown -->
RichmondMC
<div class="nav-collapse collapse navbar-responsive-collapse">
<ul class="nav navbar-nav">
<li>Movie Database</li>
<li>Gallery</li>
<li>Ratings</li>
</ul>
<!-- end navbar-nav -->
<ul class="nav navbar-nav pull-right">
<li class="dropdown">
<span class="glyphicon glyphicon-user"></span> My Account <strong class="caret"></strong>
<ul class="dropdown-menu">
<li><span class="glyphicon glyphicon-wrench"></span> Settings</li>
<li><span class="glyphicon glyphicon-list-alt"></span> Register New User</li>
<li class="divider"></li>
<li><span class="glyphicon glyphicon-play"></span> Sign In</li>
<li><span class="glyphicon glyphicon-off"></span> Sign Out</li>
</ul>
<!-- end dropdown-menu -->
</li>
<!-- end dropdown -->
</ul>
<!-- end myAccount-dropdown -->
</div>
<!-- end nav-collapse -->
</div>
<!-- end container -->
</div>
<!-- end navbar -->
<div class="modal fade" id="registerModal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
×
<h4 class="modal-title"><span class="glyphicon glyphicon-th-list"></span> New User Registration </h4>
</div>
<!-- end modal-header -->
<div class="modal-body">
<h5>Enter the New Members details including username/password to complete registration</h5><br>
<form action="" class="form-horizontal" method="post">
<div class="form-group">
<label for="username" class="col-lg-4 control-label">Username:</label>
<div class="col-lg-8">
<input type="text" class="form-control" id="username" name="username" placeholder="Username" required>
</div>
</div>
<div class="form-group">
<label for="password" class="col-lg-4 control-label">Password:</label>
<div class="col-lg-8">
<input type="password" class="form-control" id="password" name="password" placeholder="Password" required>
</div>
</div>
<div class="form-group">
<label for="firstName" class="col-lg-4 control-label">First Name:</label>
<div class="col-lg-8">
<input type="text" class="form-control" id="firstName" name="firstName" placeholder="First Name" required>
</div>
</div>
<div class="form-group">
<label for="lastName" class="col-lg-4 control-label">Last Name:</label>
<div class="col-lg-8">
<input type="text" class="form-control" id="lastName" name="lastName" placeholder="Last Name" required>
</div>
</div>
<div class="form-group">
<label for="emailAddress" class="col-lg-4 control-label">Email Address:</label>
<div class="col-lg-8">
<input type="text" class="form-control" id="emailAddress" name="emailAddress" placeholder="Email Address" required>
</div>
</div>
<div class="form-group">
<label for="phoneNumber" class="col-lg-4 control-label">Phone Number:</label>
<div class="col-lg-8">
<input type="text" class="form-control" id="phoneNumber" name="phoneNumber" placeholder="Phone Number" required>
</div>
</div>
<div class="form-group">
<label for="role" class="col-lg-4 control-label">Privileges</label>
<div class="col-lg-8">
<select name="Role" id="role" class="form-control">
<option value="member" name="privilege">Member</option>
<option value="admin" name="privilege">Admin</option>
</select>
</div>
</div>
<button class="btn btn-success pull-right" type="submit" name="submit" id="alertMe">Submit</button><br>
</form>
<!-- end form -->
</div>
<!-- end modal-body -->
</div>
<!-- end modal-content -->
</div>
<!-- end modal-dialog -->
</div>
<!-- end modal -->
</body>
</html>