Page 1 of 1

What am i doing wrong?

Posted: Fri Jun 03, 2011 2:12 pm
by ashwood
i have:
[syntax=php]<form action='index.php?act=music&action=a100b22847a2' method='POST'>
<select name='filter_options'>
<option> View Filter </option>
<option value="filter_allmusic">All Music</option>
<option value="filter_mymusic">My Music</option>
</select>
<input type='submit' name='change_filter' value='Go' />
</form>
</div>
<div style='clear: both;'></div>
<br />
<?php

$submit = $_POST['change_filter'];
$mymusic = $_POST['filter_mymusic'];
$allmusic = $_POST['filter_allmusic'];

if(!$submit)
{
if($mymusic)
{
echo "MY MUSIC";
}
else if ($allmsuic)
{
echo "ALL MUSIC";
}
}

?>[/syntax]


but it isn't detecting wether they selected my music or all music on the form.. where am i going wrong.. thanks

Re: What am i doing wrong?

Posted: Fri Jun 03, 2011 3:23 pm
by jacek
you need to check the value of $_POST['filter_options'] ie

[syntax=php]if (isset($_POST['filter_options']) && $_POST['filter_options'] === 'filter_mymusic'){
// my music
}else{
// all music.
}[/syntax]

Re: What am i doing wrong?

Posted: Fri Jun 03, 2011 3:36 pm
by ashwood
thanks :D