0

How do I give my php program input?

I'm writing some program in php but I'm not able to make it receive input so as it gives output. What can I do?

12th Jan 2017, 5:12 PM
Tuchy
Tuchy - avatar
5 Respuestas
+ 5
Put a <form method="get" action="yourPhpFile.php> in the .html and in your php file $_GET or $_POST. <body> <form method="get" action=" yourPhpFile.php"> Data:<input type="text" name="yourData"/> <input type="submit"/> </form> </body> // yourPhpFile.php $yourDataSaved = $_GET["yourData"];
12th Jan 2017, 6:00 PM
Iván
Iván - avatar
+ 2
@Tuchy Do you mean something like this? <p><?php echo $yourDataSaved; ?></p> ...but remember that if you want to do something like this you will have to change the .html for .php in the page where the form is, and you have to require the php file where you receive the input data: <?php require "yourPhpFile.php"; ?> <DOCTYPE html> <html> ... <p><?php echo $yourDataSaved; ?></p> ... </html>
13th Jan 2017, 11:31 PM
Iván
Iván - avatar
+ 1
Do you want an output from a HTML form?
12th Jan 2017, 5:16 PM
David Sebastian Keshvi Illiakis
David Sebastian Keshvi Illiakis - avatar
0
I'm coding with solo learn, and I want input for my php, I'm fine with giving the output
12th Jan 2017, 5:52 PM
Tuchy
Tuchy - avatar
0
okay, now I have been able to give my program input but how do I get the input data and assign it to a variable so I can deal with it
12th Jan 2017, 8:29 PM
Tuchy
Tuchy - avatar