Jump to content

insert data in table through forms


drekha

Recommended Posts

I am not able to insert data in my database through forms.Please help .I expect this site is very active in helping newbies..

My code is :
form.php

<?php
echo"
<html>

<form name=\"AccessInterface\" action=\"process.php\" method=post>
DoctorsID:<input name=\"DoctorsID\" type=\"text\" size=\"25\" ><br>
Organization:<input name=\"Organization\" type=\"text\" size=\"25\" ><br>
password:<input name=\"password\" type=\"text\" size=\"25\" ><br>
<input type=Submit value=\"insert\">
</form>
</html>
";
?>



process.php

<html>
<?php
$cn=odbc_connect('doctordb','root',' ');
echo"connected";
if(!$cn)
Error_handler("nop connection",$cn);

$query="Select * from Table1";
$cr=odbc_exec($cn,$query);
$nbrow=0;
while( odbc_fetch_row( $cr )) {
$nbrow++;

echo"<tr><th>DoctorsID</th><th>Organization</th><th>password</th></tr>\n";
$DoctorsID=odbc_result($cr,1);
$Organization=odbc_result($cr,2);
$password=odbc_result($cr,3);
echo"<tr><td>$DoctorsID</td><td>$Organization</td><td>$password</td></tr>\n";
}
odbc_close($cn);
exit();
$cn=odbc_connect('doctordb','root',' ');
$query1="Insert into Table1 values('$DoctorsID'],'$Organization','$password)";
$cr1=odbc_exec($cn,$query1);
odbc_close($cn);
?>
</html>



Link to comment
Share on other sites

  • 7 months later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.