Here is my form:
and script
I get these errors
Warning: mysql_fetch_ass oc() expects parameter 1 to be resource, boolean given in /home3/spizz/public_html/bettercabletv.c om/process.php on line 12
Warning: Cannot modify header information - headers already sent by (output started at /home3/spizz/public_html/bettercabletv.c om/process.php:12) in /home3/spizz/public_html/bettercabletv.c om/process.php on line 13
Any pointers?
Code:
<form name="zipcode_search" id="form" class="form" method="post" action="process.php"> <input name="zip" id="zip" type="text" placeholder="Zip Code" maxlength="5"/> <button name="submit" id="search" type="submit"> Search </button> </form>
Code:
<?php
$host="localhost";
$base="mydb";
$user="myusername";
$pass="mypassword";
$connect=mysql_connect($host, $user, $pass) or die("Could not connect to database!!!!");
mysql_select_db($base,$connect) or die("Count not find database table!");
if(isset($_POST['zip'])){
$zip=htmlspecialchars(mysql_real_escape_string($_POST['zip']));
$res=mysql_fetch_assoc(mysql_query("SELECT url FROM redirect WHERE zip='$zip'"));
header('Location: '.$res['url']);
exit;
}
else{
header('Location: http://www.bettercabletv.com/not-listed.html');
}
?>
Warning: mysql_fetch_ass oc() expects parameter 1 to be resource, boolean given in /home3/spizz/public_html/bettercabletv.c om/process.php on line 12
Warning: Cannot modify header information - headers already sent by (output started at /home3/spizz/public_html/bettercabletv.c om/process.php:12) in /home3/spizz/public_html/bettercabletv.c om/process.php on line 13
Any pointers?
Comment