Displaying data from database in bootstrap modal form(PHP&MySQL) -


i new both bootstrap , php. have created registration modal form register users site , registers perfectly. however, retrieve users details database based on user id , display details in registration form them edit , update. don't know how display records in form fields... please providing simple syntax this.

i using php , mysql

this modal form

<div class="modal fade" id="updatelecmodal" tabindex="-1" role="dialog" aria-labelledby="updatelecmodallabel" aria-hidden="true">       <div class="modal-dialog">         <div class="modal-content">           <div class="modal-header">             <button type="button" class="close" data-dismiss="modal" aria-label="close"><span aria-hidden="true">&times;</span></button>             </div>           <div class="modal-body">             <!--end of modal-->              <!-- start of form-->              <form id="updatelecform" class="form-horizontal" role="form" method="post" action="#" nonvalidate>                  <div class="form-group">                     <label for="student_id" class="col-sm-3 control-label">lecturer id</label>                     <div class="col-lg-9">                     <input type="text" class="form-control" name="lec_id" required placeholder="enter user id">                     </div>                 </div>                  <div class="form-group">                     <label class="col-lg-3 control-label">full name</label>                     <div class="col-lg-4">                         <input type="text" class="form-control" name="firstname" required placeholder="first name" />                     </div>                     <div class="col-lg-4">                         <input type="text" class="form-control" name="lastname" required placeholder="last name" />                     </div>                 </div>                 <div class="form-group">                     <label for="email" class="col-sm-3 control-label">email</label>                     <div class="col-lg-9">                     <input type="email" class="form-control" name="lec_email" required placeholder="####@##.com">                     </div>                 </div>                     <label class="col-xs-3 control-label" name="lec_gender">gender:</label>                      <label class="radio-inline control-label">                         <input type="radio" name="optionsradio" id="gender" value="male">male                     </label>                      <label class="radio-inline control-label">                       <input type="radio" name="optionsradio" id="gender" value="female">female                     </label>                      <div class="form-group">                     <label for="password" class="col-sm-3 control-label">password</label>                     <div class="col-sm-7">                     <input type="password" id="password" class="form-control" name="password" required placeholder  ="enter password">                     </div>                 </div>                 <div class="form-group">                     <label for="password" class="col-sm-3 control-label">confirm password</label>                     <div class="col-sm-7">                     <input type="password" id="password2" class="form-control" name="cpassword" data-validate-linked="password" required placeholder  ="re-enter password">                     </div>                 </div>                 <div class="modal-footer">                     <button type="submit" class="btn btn-primary">register</button>                     <button type="button" class="btn btn-default" data-dismiss="modal">cancel</button>                     <button type="reset" class="btn btn-default">reset</button>                 </div>                 </form>                      <!--end of registration form-->           </div>         </div>       </div>     </div> 

i dont know how include php in form disappears if include links further reading on php appreciate.

without seeing code it's difficult give more specific help. however, store user's id in session. when view form brab id session , sql call db, like:

select firstname,lastname,email, table_name id=$id 

obviously select, table_name, , clause depends on own tables , variables.

run sql command , store columns variables. place variable value of input:

<input type="text" value="<?php echo $name != '' ? $name : ''; ?>" /> 

basically, did above shorthand if statement says if $name isn't blank print it, otherwise print nothing.


Comments

Popular posts from this blog

android - Gradle sync Error:Configuration with name 'default' not found -

java - Andrioid studio start fail: Fatal error initializing 'null' -

html - jQuery UI Sortable - Remove placeholder after item is dropped -