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?
5 Antworten
+ 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"];
+ 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>
+ 1
Do you want an output from a HTML form?
0
I'm coding with solo learn, and I want input for my php, I'm fine with giving the output
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