INSERTING NEW DATA
The following code will take data from a HTML form and insert it into the TEST_TABLE in the sample database. The form passes three variables: $name, $email, and $phone.
Sample PHP Code:
<?php
// A connection to oracle has been made using the $conn variable
// This script assumes that an html form has passed three variables:
// $name, $email, and $phone
// Assign SQL
$sql = "insert into TEST_TABLE
values(id.nextval, :name, :email, :phone)";
// Parse SQL
$stmt = OCIParse($conn,$sql);
// Bind php variables to Oracle columns
OCIBindByName($stmt,"NAME",$name);
OCIBindByName($stmt,"EMAIL",$email);
OCIBindByName($stmt,"PHONE",$phone);
// Oracle converts all column names into UPPERCASE
// Run SQL
OCIExecute($stmt);
// Redirect to display page
header( 'Location: db_select_run.php');
?>