NYCPHP Meetup

NYPHP.org

[nycphp-talk] Having problems with PHP or maybe something bigger...

Anthony Wlodarski aw at sap8.com
Tue Jul 24 11:08:51 EDT 2007


Hello all,

I am currently contracted by my boss to create a candide/company tracking system in PHP/MySQL and have hit a little snag.

Here is the code:

function displayCandidates($managerid)
{
	$sqlcandidates = "SELECT * FROM `candidate` WHERE `managerid` = ".$managerid."";
	$resultcandidates = mysql_query($sqlcandidates) or die('Error, get candidates query failed');

	while($row = mysql_fetch_array($resultcandidates, MYSQL_ASSOC))
	{
		echo "<tr style='border: solid 2px black; background-color: ".$row['color']."'>\n";
    		echo "<td style='border: solid 2px black; width: 100px;'></td>\n";
		echo "<td style='border: solid 2px black; width: 300px;'></td>\n";
		echo "<td style='border: solid 2px black; width: 300px;'>".$row['name']."</td>\n";
		echo "<td style='border: solid 2px black; width: 100px;'>".$row['status']."</td>\n";
		// add a edit button
		echo "<td style='border: solid 2px black; width: 100px; text-align: center;'>\n";
		echo "<form action='./edit.php' method='post'>\n";
		echo "<input type='hidden' name='id' value='".$row['id']."'>\n";
		echo "<input type='hidden' name='database' value='candidate'>\n";
		echo "<input type='submit' name='edit' value='Edit'>\n";
		echo "<form>\n";
		echo "</td>\n";
		echo "</tr>\n";
	}
}

Now that code would create a button at the end of the table row that should call the php file "edit.php" however when I go to the webpage the button links to "names.php" which is the name of the file that contains this code.  I do have references to $_SERVER['PHP_SELF'] in the code in other places to call the script itself if certain buttons are pressed but I don't see how that could have interfered.  It is blowing my mind because I thought it would be a simple thing to fix but I can't figure it out.  I even moved the form echo statements to a test file on the server and it does not do this at all.
-Anthony W.
Technical Recruiter
Shulman Fleming & Partners
aw at sap8.com
646 285 0500 x230





More information about the talk mailing list