Use ORA to input data into the data table 'email_info'
When the user browses this script, a form consisting of name and email input fields is displayed; when the user adds the data and clicks submit, the script will Name and email are saved in the 'email_info' data table.
Related PHP code:
if ($submit == "click"){
// The submit button was clicked!
// Get the input for fullname and email then store it in the database.
PutEnv("ORACLE_SID=ORASID");
$connection = Ora_Logon ("username","password");
if ($connection = = false){
echo Ora_ErrorCode($connection).": ".Ora_Error($connection)."
";
exit;
}
$cursor = Ora_Open ( $connection);
if ($cursor == false){
echo Ora_ErrorCode($connection).": ".Ora_Error($connection)."
";
exit;
}
$query = "insert into email_info values ('$fullname', '$email')";
$result = Ora_Parse ($cursor, $query);
if ($result == false){
echo Ora_ErrorCode($cursor).": ".Ora_Error($cursor)."
";
exit;
}
$result = Ora_Exec ($cursor);
if ($result == false){
echo Ora_ErrorCode($cursor).": ".Ora_Error($cursor)."
";
exit;
}
Ora_Commit ($connection);
Ora_Close ($cursor);
Ora_Logoff ($connection);
}
else{
echo '
<FORM action=insert.php method=post>
Please enter your name
<INPUT name=fullname></INPUT>
Please enter your email address
<INPUT name=email></INPUT> <🎜>
<INPUT name=submit type=submit value=click></INPUT> <
';
}
?>
By the way, this script must be saved as insert.php, because insert.php is specified in the calling page. form handler
http://www.bkjia.com/PHPjc/315644.html