Jump to content

[SOLVED] Help Please/Cannot get header to work


affordit

Recommended Posts

Can someone tell me what I am missing here? I have confirmed the access to the DB but can not get the header part to work.

<?php 
// this starts the session 
session_start();
$client_name=$_POST['client_name'];
$psword=$_POST['psword'];
echo $client_name;
echo $psword;

include("teao_1_dbinfo2.inc");
$dbh=mysql_connect ("localhost","$name",
"$password") or die('Cannot connect to the database because:'.mysql_error());
mysql_select_db ("$database");

$query = "Select * from projects Where client_name = '$client_name' and psword = '$psword'";
$results = mysql_query($query) or die(mysql_error()."<br /><br />".$query);
$num=mysql_numrows($results);
if ($num >0) {

$result = mysql_fetch_array($results);
       $_SESSION['client_name'] = $client_name;
       $_SESSION['psword'] = $psword;
       $_SESSION['project_id'] = $result['project_id'];
       $_SESSION['start_date'] = $result['start_date'];
       $_SESSION['project_duration'] = $result['project_duration'];
       $_SESSION['finish_date'] = $result['finish_date'];
   $_SESSION['temp_url'] = $result['temp_url'];

       (header("location: http://mysite.com/1_projects/". $_SESSION['project_id'] . ".php"));


} else {
echo "<table align='center' width='300'><tr><td align='center'><b>The Username and Password you entered do not match any of our records. Thank You</b></td></tr></table>";
}
?>

It's giving you an error because you're echoing $client_name and $psword. Remove those two echos and it should work out fine if everything else is in order.

 

You can't send text to the browser before using functions that send special headers.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.