Calling A PHP page from html

I am trying to create a php page that allows a user to enter numbers then the php will run using the numbers that the user entered.

<?php
$x =
$y =
$z =
?>

<?php echo "\n"; echo $x + $y + $z; echo "\n";?>

<?php echo $x * $y * $z; echo "\n\n";?>

<?php echo $x / $y * $z; echo "\n\n";?>

<?php echo $x - $y - $z; echo "\n";?>

<?php echo -$x; echo "\n";?>

<?php echo $y - $x; echo "\n";?>

this is the php part the html is

: : :

this is calling the php page i have but i dont know how to assign the x,y,z to be the numbers the user put it the submit box. ANy help?

first off use the code tags

now lets get to your code

[php]

<?php $x = $_GET['user1']; $y = $_GET['user2']; $z = $_GET['user3']; ?>

<?php echo "\n"; echo $x + $y + $z; echo "\n";?>

<?php echo $x * $y * $z; echo "\n\n";?>

<?php echo $x / $y * $z; echo "\n\n";?>

<?php echo $x - $y - $z; echo "\n";?>

<?php echo -$x; echo "\n";?>

<?php echo $y - $x; echo "\n";?>

this is the php part the html is

: : : [/php]

assigning names must me different for different inputs
then at top you can assign the variables

you can try that if it is what you wanted

now from the html how do i get that to be what the php receives?

you are telling php to get it by using the names

name=“user3” and so on
is your script called tut.php

i made your code wrong

here is modified
[php]

<?php $x = $_GET['user1']; $y = $_GET['user2']; $z = $_GET['user3']; ?>

<?php echo "\n"; echo $x + $y + $z; echo "\n";?>

<?php echo $x * $y * $z; echo "\n\n";?>

<?php echo $x / $y * $z; echo "\n\n";?>

<?php echo $x - $y - $z; echo "\n";?>

<?php echo -$x; echo "\n";?>

<?php echo $y - $x; echo "\n";?>

this is the php part the html is

:

:

:

[/php]

okay now when i hit submit all it does is bring up the php page but it doesn’t run the php

http://projects1.ezewh.com/tut.php?user1=34&user2=54&user3=65

did you type anything in the inputs

This tutorial is for searching but as you will see you can do anything you want with the php code. The basic premiss of the tutorial is java calls a php file that does something after every key stroke. It should do what your asking if you edit it correctly.

http://www.phphelp.com/forum/index.php?topic=17363.0

Sponsor our Newsletter | Privacy Policy | Terms of Service