I
I
Igor Kaspersky2015-11-16 23:55:54
PHP
Igor Kaspersky, 2015-11-16 23:55:54

How to connect php and html?

How to make it read what is in the input, and how to make a variable or something, everything about this php is generally vague.
<input type="number" value="" name="fact">

<?php    
   $fact = ["fact"];
?>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Apostle, 2015-11-17
@HHabar

For example so.
example.php file:

<form method="POST">
    <input type="number" value="123456789" name="fact">
    <input type="submit">
</form>
<?php 
    $fact = isset($_POST["fact"]) ? $_POST["fact"] : '';
    echo $fact;
?>

Run the web server in the directory where the file was created, for example, with the command:
Open the page 127.0.0.1:8080/example.php in the browser , after clicking the send data button on this page, the number 123456789 will be displayed.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question