Jump to content

[SOLVED] PHP and Post


Minase

Recommended Posts

hy there i do have the following code

 

echo '
<tr><td align="center" class="tdn" colspan=3><select class=input name="wn" size=1><option value="b">tagged messages<option value="a">all messages<option value="c">untagged messages</select>

<select name="to" size=1 class=input>
<option value="l">delete</select>
<input type=submit name="do" class=input value="Go!"></th></tr>
';

if (isset($_POST['wn']))

if ($_POST['wn'] == 'a') {
mysql_query("DELETE FROM `" . DBPREFIX . "users_messages` WHERE ReciverID = " . $_SESSION['user_id']) OR DIE(mysql_error());
} elseif ($_POST['wn'] == 'b') {

foreach($_POST as $a => $b){

	if(preg_match("/x/",$a) && $b == 'on'){

		$id = str_replace("x","",$a);
		$note_query = mysql_query("SELECT * FROM `" . DBPREFIX . "users_messages` WHERE UID='".$id."' AND ID='".$_SESSION['user_id']."' ");
		if($note_query){
			$deleted++;
			mysql_query("DELETE FROM `" . DBPREFIX . "users` WHERE UID='".$id."'");
		}
	}
}

}

 

i was wondering what i did wrong,cause whatever i select it doesnt do anything.

if i select to delete everything (the query is good) but it doesnt delete..

thank you

Link to comment
https://forums.phpfreaks.com/topic/112368-solved-php-and-post/
Share on other sites

Just to let you know you do not need to use echo to echo out HTML code. You can close the opening php tag, and then reopen a new one where you need it.

 

so instead of echo replace it with , this is assuming that there is PHP above this HTML code.

?>
<tr><td align="center" class="tdn" colspan=3>
<select class=input name="wn" size=1>
<option value="b">tagged messages</option>
<option value="a">all messages</option>
<option value="c">untagged messages</option>
</select>

<select name="to" size=1 class=input>
<option value="l">delete</option>
</select>
<input type=submit name="do" class=input value="Go!"></th></tr>
<?

 

Link to comment
https://forums.phpfreaks.com/topic/112368-solved-php-and-post/#findComment-576921
Share on other sites

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.