I have 2 radio buttons, and each does an action and redirects to that action. But I need it to keep my current page (or week in this case) so it redirects to the correct page.
I think I'm not using the php syntax correctly inside of the onclick.
echo ' <input type="radio" ' . (($spreads == 'yes') ? ' checked="checked"' : '') . ' onclick="window.location=\'' . ((!empty($_GET['week'])) ? '?week=' . (int)$_GET['week'] : '') . '\'&action=spreads\'"/><label>Show</label>' . "
";
So it should get the week that the user is on, and redirect. So the URL would be something like: http://www.testsite.com/page.php?week=4?action=spreads
EDIT: I should have mentioned it was all inside of an echo to begin with.
EDIT 2: If i use a variable instead, it works just like I want it to. Very odd... I still would like to know how to use it without a variable. Works:
$week_number = ((!empty($_GET['week'])) ? '?week=' . (int)$_GET['week'] : '');
//radio button
echo ' <td><input class="radio" type="radio" id="Show" ' . (($spreads == 'yes') ? ' checked="checked"' : '') . ' value="Show" onclick="location.href=\''.$week_number.'&action=spreads\'"/><label class="choice" for="Show">Show</label>' . "
";