Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to load a form on Jquery button click?
    text
    copied!<p>I have two forms in one php file. Form1 will get input from user and passes query to the Mysql database and retrieves data from the database and have to populate the Form2.</p> <p>initially the Form2 is hidden and when the user selects the inputs in Form1 and click submit, the Form values is to be passed to the php part through form POST and performs mysql fetch and displays the Form2 with the values.</p> <p>input button of Form1:</p> <pre><code> &lt;input id="buttonProductionSummary" class="buttonProductionSummary" type="submit" value="Submit" /&gt; </code></pre> <p>Code to POST form values:</p> <pre><code>$date=$_POST['datepicker']; $machine = $_POST['selectMachine']; $user = $_POST['selectUser']; $shift=$_POST['selectShift']; $start_time_query = mysql_query("select time from rpt_shift_log where ((date='$date' and shift_def='$shift' and event_type='$even_type_up_id') and (machine='$machine' and employee='$user'))"); while($start_time_Row = mysql_fetch_assoc($start_time_query)) { $start_time = $start_time_Row['time']; } </code></pre> <p>and i'm using the calculated value in textbox of Form2 like this.</p> <pre><code> &lt;input id="start_time_text" class="start_time_text" type="text" name="start_time_text" value="&lt;?php echo $start_time?&gt;"&gt; </code></pre> <p>but right now i have blocked the script to load the Form2 on button click. JQuery code to Load the form on Button Click:</p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function(){ $("#buttonProductionSummary").click(function(e) { $("#productionForm").show(); e.preventDefault(); }); }); &lt;/script&gt; </code></pre> <p>The problem is, if the JQuery script executes, the Form POST doesn't happening. if the POST is to happen, i have to comment the script.</p> <p>how can i do the POST first and retrieve data from the Database and then show the Form2 with the data retrieved.</p> <p>can someone help me out? </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload