Pallchrn2 Posted April 22, 2012 Share Posted April 22, 2012 I need to use a HTML form to retrieve data in a certain order of ascending/descending using a drop down box and a true/false statement button for one of the values from a MySQL database. Im guessing I need a php script to query the database, but can I add the php code to the HTML or upload a php to the server that links the HTML thank you Quote Link to comment Share on other sites More sharing options...
requinix Posted April 22, 2012 Share Posted April 22, 2012 If you don't mind refreshing the page then you just use normal PHP form handling stuff. If you don't want to refresh then look into a little thing called "AJAX"... Quote Link to comment Share on other sites More sharing options...
Pallchrn2 Posted April 22, 2012 Author Share Posted April 22, 2012 Sorry forgot to say it has submit button that links to php on server, does it just need to redirect and the php do all the rest (eg query the order and display the page) thanks Quote Link to comment Share on other sites More sharing options...
MMDE Posted April 22, 2012 Share Posted April 22, 2012 To redirect: header("Location: http://www.example.com/"); Make sure it's before any output to the browser. A common looking form: <form action="" method="post"> <input type="text" name="sometext" /> <input type="submit" name="submit" value="submit" /> </form> The action parameter in the form decides what page the user will visit and send the post data to when they hit the submit button. To access the post data: if(is_set($_POST['sometext'])){ echo $_POST['sometext']; } What you need help with is a bit unclear, so I hope this helps you. 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.