Note that there are some explanatory texts on larger screens.

plurals
  1. POhtml form inputs are not saved in MySQL
    primarykey
    data
    text
    <p>i have a username/password <code>&lt;form&gt;</code> and if false, will display <em>invalid users</em>, if true will display a <code>&lt;textarea&gt;</code> and users can comment then submit.</p> <p>basically, the code below, is the <code>then</code> statement that <em>if login is correct then..</em></p> <pre><code>session_start(); $_SESSION['name'] = $name; echo "success, hi $name"; echo "&lt;table&gt; &lt;tr&gt;&lt;td&gt;insert comment here&lt;/td&gt;&lt;td&gt;poster&lt;/td&gt; &lt;tr&gt;&lt;td&gt;&lt;form action='post.php' method='post'&gt;&lt;textarea name='content'&gt;&lt;/textarea&gt; &lt;/td&gt; &lt;td&gt; $name&lt;/td&gt; &lt;/tr&gt; &lt;input type='submit' name='submit' value='submit'&gt; &lt;/form&gt; &lt;/table&gt;"; </code></pre> <p>in relation to the <code>&lt;form&gt;</code> above, i created <em>post.php</em> which will parse all data coming from the <code>&lt;form&gt;</code> and insert it into the database.</p> <pre><code>&lt;?php mysql_connect("localhost","root","") or die (mysql_error()); mysql_select_db("data") or die (mysql_error()); ?&gt; &lt;?php if (isset($_POST['submit'])) { $cont = $_POST['content']; //data coming from index.php &lt;form&gt; mysql_query("insert into data ('content') values ('$cont')"); } else { } ?&gt; </code></pre> <p>what baffles me, is there are no errors being shown. when I input something on my <code>&lt;textarea&gt;</code> then clicked submit, it goes to <em>localhost/post.php</em> but when i refresh to the index page, the submitted data was not saved/recorded to the database.</p>
    singulars
    1. This table or related slice is empty.
    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