Use ORA to enter data into the data table 'email_info'
When the user browses this script, a form consisting of the name and email input fields is displayed; when the user adds the data and clicks to submit, the script program will save the name and email to 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= method=post>
Please enter your name
<INPUT name=fullname></INPUT>
Please enter the email address
<INPUT name=email></INPUT>
<INPUT name=submit type=submit value=click></INPUT>
</FORM>
';
}
?>
By the way, this script must be saved as it is specified as a form handler in the called page.
When the user browses this script, a form consisting of the name and email input fields is displayed; when the user adds the data and clicks to submit, the script program will save the name and email to 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= method=post>
Please enter your name
<INPUT name=fullname></INPUT>
Please enter the email address
<INPUT name=email></INPUT>
<INPUT name=submit type=submit value=click></INPUT>
</FORM>
';
}
?>
By the way, this script must be saved as it is specified as a form handler in the called page.