Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here is how you do it save this file as connection.php Please be aware there is no validate script here. This is just a simple example of how to insert the record into database using php mysql on a same page.</p> <pre><code>Save this file as conn.php &lt;?php $hostname_tfc_conn = "servername"; $database_tfc_conn = "connname"; $username_tfc_conn = "dbusernanme"; $password_tfc_conn = "dbpassword"; $tfc_conn = mysql_pconnect($hostname_tfc_conn, $username_tfc_conn, $password_tfc_conn) or trigger_error(mysql_error(),E_USER_ERROR); ?&gt; Now name the following page as you want &lt;?php include_once("conn.php"); $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } if ((isset($_POST["MM_insert"])) &amp;&amp; ($_POST["MM_insert"] == "form1")) { $insertSQL = sprintf("INSERT INTO user (username, password, email) VALUES (%s, %s, %s)", ($_POST['name'], "text"), ($_POST['password'], "text"), ($_POST['email'], "text")); mysql_select_db($database_tfc_conn, $tfc_conn); $Result1 = mysql_query($insertSQL, $tfc_conn) or die(mysql_error()); $insertGoTo = "filename.php";//Put you filename here if the record is successful header("Location: %s", $insertGoTo)); } ?&gt; &lt;body&gt; &lt;form id="form1" name="form1" method="POST" action="&lt;?php echo $editFormAction; ?&gt;"&gt; &lt;p&gt;Name : &lt;input type="text" name="name" id="name" /&gt; &lt;/p&gt; &lt;p&gt;Email: &lt;input type="text" name="email" id="email" /&gt; &lt;/p&gt; &lt;p&gt;Password: &lt;input type="text" name="password" id="password" /&gt; &lt;/p&gt; &lt;p&gt; &lt;input type="submit" name="button" id="button" value="Submit" /&gt; &lt;/p&gt; &lt;input type="hidden" name="MM_insert" value="form1" /&gt; &lt;/form&gt; </code></pre>
    singulars
    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