drekha Posted February 21, 2006 Share Posted February 21, 2006 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<?phpecho"<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 https://forums.phpfreaks.com/topic/3513-insert-data-in-table-through-forms/ Share on other sites More sharing options...
jvrothjr Posted October 19, 2006 Share Posted October 19, 2006 [code=php:0]$query1="Insert into Table1 ('DoctorsID','Organization','password') values ($_POST[DoctorsID],$_POST[Organization],$_POST[password])";[/code] Link to comment https://forums.phpfreaks.com/topic/3513-insert-data-in-table-through-forms/#findComment-111195 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.