Issue with submit

I am having one of those problems that you just cant figure out even though its simple code.

Here is my html:

[code]








User List - Account Deletion

<?php echo $message; ?>
[/code]

Here is my php:
[php]<?php

if(isset($_POST[‘yes’])){
echo “test”;
//mysql_query(“DELETE FROM users WHERE id=$id”);
//header(“Location:?p=userlist”);
echo “yes”;
}

if(isset($_POST['no'])){
	//header("Location:?p=userlist");
echo "no";
}


$id = $_SESSION['userID'];


$result = mysql_query("SELECT * FROM users WHERE id=$id");
while($row = mysql_fetch_array($result)){
	$fname = $row['first_name'];
	$lname = $row['last_name'];
}

	
$message = "Are you sure you want to delete the user: ".$fname." ".$lname."? <input type='submit' name='yes' value='Yes'><input type='submit' name='no' value='No'>";

?>[/php]

When I click either yes or no I go to a blank page (its the same page). And I can’t even echo out if its getting to the isset if statements. Its probably something stupid, but it happens.

Do you have error reporting on? If it’s off you might get a blank page if you have errors in your code. Try adding this to the start of your page, and see if you get any errors:
[php]ini_set(‘error_reporting’, E_ALL);[/php]
It seems to work fine for me, so without any errors I’m not sure what’s wrong.

[ul][li]You should fix your indenting though, hard to see how those if’s work. Which text editor are you using?[/li]
[li]You should not insert variables directly into the query, no matter where they come from.[/li]
[li]You should be using mysqli or PDO, with parameterized queries, mysql_* is deprecated.[/li][/ul]

Sponsor our Newsletter | Privacy Policy | Terms of Service