dani33l_87 Posted June 10, 2014 Share Posted June 10, 2014 <html><body><form action="url.php" method="post">Website: <input type="text" name="web" value="phpfreak.com"><br>Category: <input type="text" name="cat" value="coding" ><br><input type="submit"></form></body></html> How can I take the value from a form and insert it in a URL that can be accessed by the user: http://{web}/{cat} A little complicate, how can I take the value without click it on submit action and open in a new page with the URL Values. Quote Link to comment Share on other sites More sharing options...
Solution akphidelt2007 Posted June 10, 2014 Solution Share Posted June 10, 2014 Well the submit button has to be pressed for the server to know what post values you have. Just redirect after you check to see if the form has been submitted if(!empty($_POST)) { $url = "http://" . $_POST['web'] . "/" . $_POST['cat']; header("Location:$url"); exit; } * Keep in mind, my code is not safe at all. Just an example Quote Link to comment Share on other sites More sharing options...
dani33l_87 Posted June 10, 2014 Author Share Posted June 10, 2014 Thanks, But why do you say is not safe at all? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.