Insert query results in just a blank page
Posted: Fri May 20, 2011 6:24 am
The form below is meant to retrieve the named attribute of a form input called "limitedtextfield" , along side the current date and store those values in a database. The form contains some javascript which can be disregarded for this particular problem.
Here is the php script that processes the form. What it is meant to do is search the database and if no record is found for the authenticated member, input the relevant values into the database. If a record is found, it should update the record. Well every time I hit the submit button, all I get is a blank page. Any clue as to what is going wrong?
PS: I checked the database and no values got inserted.
Code: Select all
<form name="mymind" style= "position:relative;left:40px;" action="insert_status.php" method="post">
<input name="limitedtextfield" type="text" onKeyDown="limitText(this.form.limitedtextfield,this.form.countdown,55);"
onKeyUp="limitText(this.form.limitedtextfield,this.form.countdown,55);" maxlength="55"><br>
<font size="1">(Maximum characters: 55)<br>
You have <input readonly type="text" name="countdown" size="3" value="55"> characters left.</font>
<input type="hidden" name="submitted" value="TRUE"/>
<input style="position:relative;left:0px;bottom:0px;" type="submit" name="submit" value="Submit!" />
</form>
Here is the php script that processes the form. What it is meant to do is search the database and if no record is found for the authenticated member, input the relevant values into the database. If a record is found, it should update the record. Well every time I hit the submit button, all I get is a blank page. Any clue as to what is going wrong?
PS: I checked the database and no values got inserted.
Code: Select all
<?php
//address error handling
ini_set ('display_errors', 1);
error_reporting (E_ALL & ~E_NOTICE);
//authenticate user
require('auth.php');
//Connect to database
require ('config.php');
if (isset($_POST['submitted'])) {
$query = "SELECT* FROM publications WHERE member_id ='".$_SESSION['id']."' AND cartegory='status'";
$result = @mysql_query($query);
$num = @mysql_num_rows($result);
if ($num> 0) {
$update = mysql_query("UPDATE publications SET publication = '{$_POST['limitedtextfield']}' WHERE member_id = '".$_SESSION['id']."' AND cartegory = 'status'");
header("Location: member.php");
} else {
$query = "INSERT INTO publications ( member_id, publication, cartegory, pub_date)
VALUES ( '{$_SESSION['id']}','{$_POST['limitedtextfield']}', 'status', NOW() )";
header("Location: member.php");
}
}
?>