Quantcast
Channel: PHP Freaks: PHP Help
Viewing all articles
Browse latest Browse all 13200

PHP Function

$
0
0

Hi 

 

Hoping someone can help so frustrated with this as I cant figure it out.

 

This is what has to happen.

 

Create a function of your choice. The function must accept  5 arguments. Create a form that accepts 5 arguments, each via a drop-down menu and echo the results back to the user.

 

This is what I have so far.

 

 

 

<?php

// Declare the function and variables


error_reporting (0);
$msg = "";
$activity = "";


// Make sure the submit button has been selected


if (isset ($_POST ['submit'])){


function activites ($paintballing , $ice_skating, $horse_riding, $para_gliding, $water_rafting ){


// Make the activity array


$activites = array (1=> 'Paintballing', 'Ice_skating', 'Horse_riding', 'para_gliding', 'water_rafting');






// use a foreach loop to loop through the activity


foreach ($activites as $key =>$value) {
$msg = "We trust you will enjoy $activity today. Have fun and create memories";
}


}


if ($activity == ""){
$msg = "<font color = 'red'> Please select an activity from the drop down menu</font>";


}


?>






<html>
<head>
<title>Function </title>
</head>
<body>
<center> <a href="index.php">Home </a>  |  <a href ="calc.php">Calc</a> | <a href="string.php">String</a> | <a href ="array.php"> Array </a> | <a href = "function.php">Function </a></center>
</center>


<form name = 'function' method = "POST" action = 'function.php' >


<p>Select one of the activity you would like to do today:</p>


<select name="Activity" size="5">
<option selected value = "">
<option> Paintballing </option>
<option> Ice-skating </option>
<option> Horse-riding </option>
<option> Para-gliding </option>
<option> Water-rafting </option>
</select>
</form>
<input type = "submit" name = "submit" value = "submit" />
</option>
<?php echo $msg;?>
<p align ="center"><a href ="function.txt" Onclick ="window.open ('function.txt', 'function', resizable =no, height=500, width=500, scrollercars=yes'); retrun false;">Function.txt</a></p>

 

Viewing all articles
Browse latest Browse all 13200

Trending Articles