PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
mohson
Forum Contributor
Posts: 372 Joined: Thu Dec 02, 2004 6:58 am
Location: London
Post
by mohson » Wed May 18, 2005 8:49 am
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");
?>
pickle
Briney Mod
Posts: 6445 Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:
Post
by pickle » Wed May 18, 2005 9:55 am
When I send headers, it's of this format:
Code: Select all
header("e;Location: http://mywebsite.etc"e;);
I imagine syntax, capitalization and whitespace are very important
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
CoderGoblin
DevNet Resident
Posts: 1425 Joined: Tue Mar 16, 2004 10:03 am
Location: Aachen, Germany
Post
by CoderGoblin » Wed May 18, 2005 10:22 am
Just to clarify... L ocation not l ocation.
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.