not sure what is producing this error

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

Post Reply
bruceg
Forum Contributor
Posts: 174
Joined: Wed Mar 16, 2005 11:07 am
Location: Morrisville, NC
Contact:

not sure what is producing this error

Post 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
rubberjohn
Forum Contributor
Posts: 193
Joined: Fri Feb 25, 2005 4:03 am

Post by rubberjohn »

try ' ' for the session var name

Code: Select all

$_SESSION['valid']
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post 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.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
myoung1620
Forum Newbie
Posts: 3
Joined: Tue Apr 18, 2006 2:15 pm
Location: VA

Error

Post by myoung1620 »

It seems you may need to test for that $_SESSION variable prior to using it.

if(isset($_SESSION['valid'])){
// blah
}
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Post by Benjamin »

PHP doesn't like Macintosh line feeds. Try saving the file in Windows or Unix format.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Which version of PHP and which web server are you using?
Post Reply