0% found this document useful (0 votes)
6 views

Php Program for Students

Uploaded by

callbackff200002
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Php Program for Students

Uploaded by

callbackff200002
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

1) Write a PHP program to find Sum of two numbers

Sum.php

<?php

$x=15;

$y=30;

$z=$x+$y;

echo "Sum: ",$z;

?>

2 ) Write a PHP program to find the given number is odd or even (using FORM controls )

oddeven.php

<html>

<body>

<form method="post" >

Enter the Number: <input type="number" name="number">

<input type="submit" value="Submit">

</form>

</body>

</html>

<?php

if($_POST)

$number = $_POST['number'];

$a = $number;

if( $a == 0 )

echo " $number an even Number";

1
}

else

echo "$number is odd number";

?>

3. Write a PHP program to find given number is odd or even (using two pages)
example.html

<html>

<body>

<form method="post" action="result.php" >

Enter the Number:

<input type="number" name="num">

<input type="submit" value="Submit">

</form>

</body>

</html>

result.php

<?php

if($_POST)

$number = $_POST['number'];

$a = $number;

if( $a == 0 )

echo " $number an even Number";

2
}

else

echo "$number is odd number";

?>

You might also like