Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It looks like you don't have a <code>&lt;form&gt;</code> in your page - the data is not getting to your server. </p> <p>Also, you are not reading the input anywhere - how do you fill your <code>$txtName</code> and <code>$txtWebsite</code> with meaningful values?</p> <p>Also, <code>InsertData</code> is a PHP function, which is executed on the <em>server side</em> - your HTML part is interpreted on the <em>client side</em> (in the browser). You can't call that function there.</p> <p>Try with this:</p> <pre><code>&lt;?php function InsertData() { $link = mssql_connect('db','123','test'); if (!$link || !mssql_select_db('php', $link)) { die('Unable to connect or select database!'); } $txtName = $_REQUEST['txtName']; $txtWebsite = $_REQUEST['txtWebsite']; $sql = " INSERT INTO customer ([Name],[Website])VALUES('$txtName','$txtWebsite')"; $result = mssql_query($sql, $link); if(!$result) { echo mssql_error(); exit; } // close the connection mssql_free_result($result); mssql_close(); echo "Data successfully inserted"; } if ($_REQUEST['txtName'] &gt; ''){ InsertData(); } ?&gt; &lt;form name="input" action="this_file_name.php" method="get"&gt; &lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt; &lt;tr&gt; &lt;td colspan="3" height="10" valign="top" width="98%"&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td width="22%"&gt; &amp;nbsp;Name:&lt;/td&gt; &lt;td width="60%"&gt;&lt;INPUT type="text" name="txtName" id="txtName" Width="200px" MaxLength="30" /&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td colspan="3" height="12" valign="top" width="98%"&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td width="22%"&gt; &amp;nbsp;Company Website:&lt;/td&gt; &lt;td width="60%"&gt;&lt;INPUT type="text" name="txtWebsite" id="txtWebsite" width="200px" MaxLength="200" /&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td &gt; &lt;/td&gt; &lt;td &gt; &lt;input type="button" value="submit" id="imgBtnSubmit" /&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&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.
    1. VO
      singulars
      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