What am i doing wrong?

Ask about a PHP problem here.
Post Reply
ashwood
Posts: 144
Joined: Thu May 12, 2011 7:17 am

What am i doing wrong?

Post 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
I would put a signature.. BUT, i don't have the time.
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: What am i doing wrong?

Post 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]
Image
ashwood
Posts: 144
Joined: Thu May 12, 2011 7:17 am

Re: What am i doing wrong?

Post by ashwood »

thanks :D
I would put a signature.. BUT, i don't have the time.
Post Reply