Note that there are some explanatory texts on larger screens.

plurals
  1. POerror correction for the PHP code
    primarykey
    data
    text
    <p>I have written the following code and not able to figure out the errors in it..</p> <p>It not poping out any errors ..what it does is that it just stays on the html page</p> <p>whats wrong in it?</p> <p>html page</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;script type="text/javascript" src="jquery.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(document).ready(function(){ function get(){ $("#button1").click(function(){ $.post('script_1.php', { name: form.name.value }, function(output) { $('#age').html(output).show(); }) ; }); } $("#button2").click(function(){ $('form#myForm').attr({action: "script_2.php"}); $('form#myForm').submit(); }); }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;form id="myForm" method="post"&gt; doi: &lt;input type="text" name="name"/&gt; &lt;input type="button" id="button1" value ="Get" onclick="get();"/&gt; &lt;input type="button" id="button2" value="Submit to script 2" /&gt; title:&lt;input type="text" name="title"/&gt; &lt;/form&gt; &lt;div id="age"&gt;&lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>script_1.php for the first button is </p> <pre><code>&lt;?php ini_set('display_errors', 1); error_reporting(E_ALL ^ E_NOTICE); //connect to database $name = mysql_real_escape_string($_POST['name']); if ($name==NULL) echo "please enter an id!"; else { $age= mysql_query("SELECT title FROM parentid WHERE id ='$name'"); $age_num_rows = mysql_num_rows($age); if ($age_num_rows==0) echo "id does not exist"; else { $sql ="SELECT * FROM parentid WHERE id = '$name'"; $result = mysql_query($sql); while($row = mysql_fetch_array($result)) { $abc_output= "Existing data of the record &lt;br /&gt;"; $abc_output .="Title: " . $row['title'] . "&lt;br /&gt;" ; $abc_output .="Report No: " . $row['reportno'] . "&lt;br /&gt;" ; $abc_output .="URL: " . $row['calc_url'] . "&lt;br /&gt;" ; $abc_output .="Institution: " . $row['institution'] . "&lt;br /&gt;" ; } } echo $abc_output; } } ?&gt; </code></pre> <p>script_2.php is another php file</p> <p>with update operation in database.</p> <p>//title form is only used in script_2.php for updation. script_1.php is used for displaying already present elements in DB.</p> <p>Help appreciated.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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