Note that there are some explanatory texts on larger screens.

plurals
  1. POMySQL database update through AJAX and PHP
    primarykey
    data
    text
    <p>I have been going to stackoverflow for hints and tips in my programming journey but I have yet to register. . .till now.</p> <p>My question is, is it possible to update/edit mysql data which I've inserted into an html/css table without having to go to another page?</p> <p>for example: when looking at the table in my browser, I wanted to edit my email information. I could just simply press the edit button then the email field becomes a text field right on the same page then I could just update it and hit save?</p> <p>thanks!</p> <p>EDIT(added my code):</p> <pre><code>$(button#edit).on('click', function() { // get email inline to this edit button var email = $(this).parent().siblings('td.email').html(); // change button from edit to save $(this).attr('id', 'save-email').html('Save'); // change email display to input field $(this).parent().siblings('td.email').html('&lt;input type="text" id="user-email" value="'+email+'" /&gt;'); }); </code></pre> <p>and this is the table I used which is formatted with php which also grabs data from my database:</p> <pre><code>echo ' &lt;tr&gt;'; echo ' &lt;td&gt;' . $row['name']. '&lt;/td&gt;'; echo ' &lt;td&gt;' . $row['age']. '&lt;/td&gt;'; echo ' &lt;td&gt;' . $row['sex']. '&lt;/td&gt;'; echo ' &lt;td&gt;' . $row['email']. '&lt;/td&gt;'; echo ' &lt;td&gt;' . $row['contact_no']. '&lt;/td&gt;'; echo ' &lt;td&gt;' . $row['school_name']. '&lt;/td&gt;'; echo ' &lt;td&gt; &lt;button id = "edit"&gt;EDIT&lt;/button&gt;'; </code></pre> <p>nothing happens,your help is greatly 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.
 

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