msaz87 Posted May 5, 2009 Share Posted May 5, 2009 Hi all, I'm trying to set up a very short form that posts two variables and upon submission, redirects the user to a page -- and the two variables are part of the URL, but I can't seem to get it right. Here's my code: <? $location_ID = "5"; $league_ID = "8"; $week_results = $_POST['week_results']; $division_results = $_POST['division_results']; $results_link = "http://www.fasports.com/manager/view_standings.php?location_id=$location_ID&league_id=$league_ID&division_id=$division_results&week=$week_results"; $divisions = " <option value=\"25\">A/B</option> <option value=\"26\">C</option> <option value=\"27\">D</option> <option value=\"28\">E1</option> <option value=\"29\">E2</option> "; $weeks = " <option>1</option> <option>2</option> <option>3</option> <option>4</option> <option>5</option> <option>6</option> <option>7</option> <option>8</option> "; ?> and the portion involving the user: <b>Results</b><br/><form action="process.php" method="post"> Division: <select name="division_results"><? echo($divisions); ?></select><br/>Week: <select name="week_results"><? echo($weeks); ?></select><input type="Submit" value="View"></form><br/> and finally, process.php... <?php header( 'Location: '.$results_link.''); ?> I'm very new to php... so I apologize in advance for any novice errors... Thanks so much for your help! Link to comment https://forums.phpfreaks.com/topic/156905-user-selects-two-options-posted-variables-complete-redirect-link/ Share on other sites More sharing options...
Potatis Posted May 5, 2009 Share Posted May 5, 2009 The redirect below will work if you don't put the http:// in your link: $results_link = "http://www.fasports.com/manager/view_standings.php?location_id=$location_ID&league_id=$league_ID&division_id=$division_results&week=$week_results"; Remove the http:// from the previous code, and then add the following code to your process.php. <?php header( "Location: http://$results_link "); ?> That's just the redirect part, who knows if the previous bit of code (your form) works. Link to comment https://forums.phpfreaks.com/topic/156905-user-selects-two-options-posted-variables-complete-redirect-link/#findComment-826619 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.