Page 1 of 1

Location header why is it not going to the link

Posted: Wed May 18, 2005 8:49 am
by mohson
Can anyone see why once my insert has been performed why the page doesnt load the URL at the bottom instead it loads the same process page. Once I click enter it should load the URL at the bottom this was working fine before.

Code: Select all

<?php
/* Connecting, selecting database */
$link = mysql_connect("xxxx", "xxxx", "xxxx")
   or die("Could not connect : " . mysql_error());

mysql_select_db("contact_management_system",$link) or die("Could not select database");
 $sql = "INSERT INTO studentwebsites (name, organisation, website) VALUES ('$name','$organisation','$website')";
 $result = mysql_query($sql,$link) or die ( mysql_error($link));;
 header ("location:http://www.soi.city.ac.uk/organisation/pl/Manage_Websites/addnewwebsite.html");
 ?>

Posted: Wed May 18, 2005 9:55 am
by pickle
When I send headers, it's of this format:

Code: Select all

header(&quote;Location: http://mywebsite.etc&quote;);
I imagine syntax, capitalization and whitespace are very important

Posted: Wed May 18, 2005 10:22 am
by CoderGoblin
Just to clarify... Location not location.

Also I always tend to put a php command "exit;" on the line after the header. Makes it clear to any reader that the code should stop there.