php - Adding a record from html form to oracle database -
i have html form want add record oracle database when hits submit. table hooking somewhat, problem when submits information come null values in database table.
html:
<form name="myform" action="/add_file.php" onsubmit="return validateform()" method="post"><!--form--> <fieldset> <label class ="label1" "name">first name: </label> <input type="text" name="fname"><br /> <label class ="label1" "name">surname: </label><input type="text" name="sname"><br/> <label for="email">e-mail address: </label><input type="text" name="email"><br /> <label "address">address: </label> <input type="text" name="address"><br /> <label class="label" "password">select password: </label> <input type="password" name="pass"><br /> <label class="label" "password">retype-password:</label> <input type="password" name="pass2"><br /> </fieldset> <fieldset><input class="button" type="submit" onclick="message()" value="submit"/> <input class="button" type="reset" value="reset form" onclick="myfunction()"/> </fieldset> </form>
php code:
$dbuser = "scott"; $dbpassword = "tiger"; $db = "orabis"; $conn = oci_connect($dbuser,$dbpassword,$db); if (!$conn){ echo "connection error"; exit; } $fname=$_post['first_name']; $sname=$_post['surname']; $email=$_post['email_address']; $address=$_post['address']; $selpass=$_post['select_a_password']; $confirm=$_post['retype_password']; $sql = "insert become_a_member_110385461(first_name,surname,email_address,address,select_a_password,retype_password) values ('".$fname."','".$sname."', '".$email."', '".$address."','".$selpass."', '".$confirm."')"; $stmt = oci_parse($conn, $sql); if (!$stmt) { echo "error in preparing statement"; exit; } oci_execute($stmt, oci_default); print "record inserted"; oci_commit($conn); oci_close($conn);
change this
$fname=$_post['fname']; $sname=$_post['sname']; $email=$_post['email']; $address=$_post['address']; $selpass=$_post['pass']; $confirm=$_post['pass2'];
Comments
Post a Comment