Page 1 of 1

not sure what is producing this error

Posted: Tue Apr 18, 2006 11:24 am
by bruceg
I don't have a good PHP editor and can't determine why an error is showing up here

Code: Select all

<?php
session_start();
if ($_SESSION[valid]  != "yes") {
header("Location:http://www.inspired-evolution.com/Recruiters.php");
exit;
}
$db_name = "bruceg_recruiters";
$table_name = "Recruiters_Listing";
$connection = @mysql_select_db($db_name, $connection) or die(mysql_error());
$sql = "SELECT id, f_name, l_name FROM $table_name ORDER BY l_name";
$result = @mysql_query($sql, $connection) or die(mysql_error());
c$num = @mysql_num_rows($result);
if ($num < 1) {
    $display_block = "<p><strong>Your search produced no results!</strong></p>";
} else {
while ($row = mysql_fetch_array($result)) {
$id = $row ['id'];
$f_name = $row['f_name'];
$l_name = $row['l_name'];
$option_block .="<option value=\"$id\">$l_name, $f_name</option>":
}

//create the entire form clock
$display_block = "
<form method=\"post\" action=\"show_mod_recruiter.php\">
<p><strong>Recruiter</strong></p>
<select name=\"id\">
$option_block
</select>
<p><input type=\"submit\" name=\"submit\" value=\"select this recruiter\"></p>
</form>";
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US" dir="ltr">
<head>
<meta http-equiv="Content-type" content="text/html; charset=ISO-8859-1" />
<title>Inspired Evolution : : Pick a recruiter</title>
<link rel="shortcut icon" href="http://www.inspired-evolution.com/favicon.ico" />
<?php require('includes/meta_tags.inc'); ?>
<link rel="stylesheet" href="Gilbert.css" type="text/css" media="screen, handheld" />
<link rel="stylesheet"
   type="text/css"
   media="print" href="print.css" />
<script type="text/javascript" src="/javascript/Google_Analytics.js"></script>
</head>
<body>


<!-- begin outer wrapper div --> 

<div id="wrapper_outer">
<a class="skiplink" href="#startcontent">Skip over navigation</a>

<!-- begin header div --> 
<div id="header"><?php require ('rotate.php'); ?><?php showImage () ;?></div>
<!-- top nav list --> 

<div id="navcontainer">
<?php require ('includes/menu.php');?>
</div>

<!-- inner content wrapper div --> 
<div id="wrapper_inner">

<!-- breadcrumbs div --> 
<div id="breadcrumbs"><a href="index.php" title="home link" accesskey="h">Home</a>   > > Pick a Recruiter</div>
<!-- text div --> 
<div id="main_content">

<!-- old browser help -->
<div class="hide">
  <p>This site has been designed to look in best in a browser that supports <a href="http://www.webstandards.org/upgrade/" 
  title="Download a browser that complies with Web standards.">web standards</a>.</p>
</div>
<h1 title="Modify a recruiter">Modify a Recruiter</h1>
<a name="startcontent" id="startcontent"></a>

<?php require('includes/icons.php'); ?>
<h2>Modify a Contact - Select from the list</h2>
<p>Select a contact from the list below, to modify a record</p>
<? echo "$display_block"; ?>
<br />
<p><a href="Recruiter.php">Recruiters</a></p>

<?php require('includes/footer_tag.php') ; ?>
<?php require('includes/redirect.php'); ?>
</div>

<!-- begin footer --> 
<div id="footer">


<?php require('includes/footer.inc'); ?>
<span class="date"><?
$last_modified = filemtime("Hireme.php");
print("Last Modified ");
print(date("m/j/y h:i", $last_modified));
?></span>
</div>

</div>
</div>

</body>

</html>
the error is here

http://www.inspired-evolution.com/pick_recruiter.php

thanks for any assistance

Posted: Tue Apr 18, 2006 11:26 am
by rubberjohn
try ' ' for the session var name

Code: Select all

$_SESSION['valid']

Posted: Tue Apr 18, 2006 11:54 am
by s.dot
I'm not sure if this is indicative of the error you are getting, but it appears you have a blank line above your opening <?php tag.

According to the manual page for session_start() you must call session start before headers are sent.

Error

Posted: Tue Apr 18, 2006 2:39 pm
by myoung1620
It seems you may need to test for that $_SESSION variable prior to using it.

if(isset($_SESSION['valid'])){
// blah
}

Posted: Tue Apr 18, 2006 4:23 pm
by Benjamin
PHP doesn't like Macintosh line feeds. Try saving the file in Windows or Unix format.

Posted: Tue Apr 18, 2006 5:23 pm
by RobertGonzalez
Which version of PHP and which web server are you using?