Hi all. Following the title of the post, let's assume.. This is the HTML code: <select name="php" id="catagories"> <option value="entry 1">Politics</option> <option value="entry 2">Entertainment</option> <option value="entry 3">Education</option> <input type="submit" name="submit"> </select> Code (markup): How do you make the php code, where when one submits the data, it is displayed instantly?? Thanks.
Judging by your post you haven't read any tutorials on PHP and the answer is just going to spark 15 more questions... An HTML form is submitted via GET or POST method. You can fetch parameters submitted via GET with $_GET and parameters submitted via POST with $_POST. If your FORM submits via POST.... and your SELECT box is named "color" to access the value of "color" you would use $_POST['color']. If the FORM submits via GET.... $_GET['color'] holds the value.
PHP creates the code you showed and sends it to the browser. The user selects one of the choices. That's it, as far as your code goes. If you want the server to see that selection, use onChange to run Javascript to send the selected choice to the server via AJAX and do whatever the browser needs to do when the server sends back the data. (Yes, from your question I know that this is way beyond what you've learned. You have to study what AJAX is and how to use it first. Then this will all make sense to you. I'd suggest jQuery - it makes AJAX almost trivial to use.)