Please help me with my code! Thanks in advance
Posted: Tue Jun 10, 2003 11:46 pm
It is supposed to be really simple, one text field that submits to a DB table with two rows. Here is the code, for some reason it does not submit to the database. Any help would be greatly appreciated. Thank you.
[NOTE] The stars were purposely put there [/NOTE]
Code: Select all
<?php
function defaultDisplay() {
include ('../header.php');
echo "<form action="$SERVERї'PHP_SELF']" method="post">"
."<b>AOR</b> "
."<input type="text" name="title" size="50" maxlength="80"><br>";
echo "<br><br><input type="submit" name="op" value="Submit">"
."<br>(Submit)</form>";
include ('../footer.php');
}
function SubmitStory() {
$db = mysql_connect("localhost", "********", "*******") or die("Sorry buddy that failed!");
mysql_select_db("audiosla_arc");
$title = mysql_escape_string($_POSTї'title']);
$query = "INSERT INTO arc_aor VALUES (NULL, '$title')";
$result = mysql_query($query, $db);
if(!$result) {
echo "There was some sort of error, nice try ass!<br>";
exit();
}
include ('../header.php');
$query = "SELECT * from arc_aor";
$result = mysql_query($query, $db);
$waiting = sql_num_rows($result, $db);
echo "<center><br>You just submitted $waiting To the Database. Thank you!</center>";
include ('../footer.php');
}
switch($op) {
case "Submit":
SubmitStory();
break;
default:
defaultDisplay();
break;
}
?>