Jump to content


Photo

insert data in table through forms


  • Please log in to reply
1 reply to this topic

#1 drekha

drekha
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 21 February 2006 - 05:38 PM

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>





#2 jvrothjr

jvrothjr
  • Members
  • PipPipPip
  • Advanced Member
  • 300 posts
  • LocationOhio

Posted 19 October 2006 - 12:27 PM

$query1="Insert into Table1 ('DoctorsID','Organization','password') values ($_POST[DoctorsID],$_POST[Organization],$_POST[password])";

If you understand everything you know nothing!

http://rcchjr.awardspace.com/




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users