i would like to know how to ask to the user for two numbers ( maybe using a form )and then process those data to show the result (submitting those data)
thanks in advance
Moderator: General Moderators
Code: Select all
.............................................
<form method = "get" action = "rcv.php">
<input type="textbox" name="n1" />
<input type="textbox" name="n2" />
</form>
...............................................Code: Select all
<?php
echo "n1 : ".$_GET[n1];
echo "n2 : ".$_GET[n2];
?>Code: Select all
<form action="action.php" method="post">
<input type="hidden" name="inputHidden" value="This input is hidden.">
<input type="text" name="inputText">
<input type="checkbox" name="inputCheckbox">
<input type="submit" value="Submit">
</form>Code: Select all
<form action="action.php" method="post">Code: Select all
<input type=...Code: Select all
<?php
/* This line extracts the POST variables; without it, your form variables will be part of the
$_POST array and look like $_POST['inputHidden'], $_POST['inputText'], etc. With this line,
your variables will look more presentable, such as $inputHidden, $inputText, etc. */
extract($_POST);
/* This line will echo "This input is hidden." */
echo $inputHidden;
/* This line will echo whatever is submitted from the text field. */
echo $inputText;
/* This chunk will echo "Yes" if the checkbox is checked and "No" if not. */
if ($inputCheckbox) {
echo "Yes";
exit;
} else {
echo "No";
exit;
}