What action i can put to form to submit echo input enter your name. It display nothing in my browser. Thanks you | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What action i can put to form to submit echo input enter your name. It display nothing in my browser. Thanks you

action file or http to my form https://code.sololearn.com/WXYmAQqPWV1S/?ref=app

22nd Aug 2022, 8:24 PM
Malick Diagne
Malick Diagne - avatar
1 Answer
0
it looks like you can't use inline PHP on the code editor. usually if i want to make an index page that has forms and want to keep it confined to just the one html page, the form can be given an action value. the flow of the PHP code can be controlled based on the value of the form's action using a switch/case block. for example, the default: block for the switch/case will be what is shown on the page when the form's action is empty or unrecognized. usually this means you make the page load up the default form. when the form is filled out and submitted, the form's action might be something like "submitted". so when the HTML page loads and the $_POST["action"] is "submitted" the flow of the switch/case block will change and display what should be shown when the form has been submitted. in your case, you want it to output the value the user put into the form. something like this: https://www.sololearn.com/compiler-playground/WZ4c8DWVx6T4 (note: i didn't check syntax, and this didnt work properly in the code playground so take this as pseudocode only!)
9th Sep 2022, 4:02 AM
Nathan Stanley
Nathan Stanley - avatar