My:PHP

Материал из synset
Перейти к: навигация, поиск

Обработка полей формы

Пусть на сервере есть файлы:

 www/index.html
 cgi/form.php 

В index.html присутствует форма с двумя полями ввода и кнопкой посылки:

 
<form action = "../cgi/test.php" method="get">
Field1: <input type="text" name="F1"/> <br>
Field2: <input type="text" name="F2"/> <br>
<input type="submit"/>
</form>

<form action = "../cgi/test.php" method="get"> Field1: <input type="text" name="F1"/> <br> Field2: <input type="text" name="F2"/> <br> <input type="submit"/> </form> Обработка посылки этой формы

 
#!/usr/bin/php 
<?
   echo("F1 = $_GET[F1]<br>");
   echo("F2 = $_GET[F2]<br>");
?>