I have created a form which passes data to a PHP file.
I then spat the results into the PHP file (this bit works)
I created a second PHP file to chuck $county in and get clubs (this bit works)
But when I try to amalgate the two scripts it just shows the first part and not the select drop down.
Where am I going wrong, no error messages?
Below is the amalgamated script:
<?PHP
MakeID ($firstName, $lastName, $results, $membershipID);
ShowResults ($firstName, $lastName, $username, $password, $handicapStart, $emailAddress, $county, $clubName, $result, $membershipID);
ShowClubs;
exit;
?>
<?php
function MakeID ($firstName, $lastName, $results, $membershipID){
$r = $firstName.$lastName;
$membershipID = substr($r, 0, 10);
echo "<form action=formresult.php method=post> These are the details you entered.<br>Please ensure they are correct and click CONFIRMED <br>or user the browsers BACK button to re enter the correct data<br><br><FONT COLOR=\"black\" SIZE=\"+1\">Membership ID =$membershipID</font>\n";
}
?> <?php
function ShowResults ($firstName, $lastName, $username, $password, $handicapStart, $emailAddress, $county){echo "
<br><FONT COLOR=\"black\" SIZE=\"+1\">Name = $firstName $lastName <br>Username = $username<br>
Password = $password<BR>
Current Handicap = $handicapStart<BR>
Your Email Address = $emailAddress <BR>
County of Home Club = $county<br><br>
</FONT>
<UL>\n";
#foreach ($GLOBALS as $Key=>$Value){
#echo "<LI>\$GLOBALS[\"$Key\"]=$Value\n";
# } # End of foreach ($GLOBALS as $Key=>$Value)
echo "</UL>\n";
} # End of function ShowResults THIS BIT WORKS
?><?php #THIS BIT WORKS ON ITS OWN
function ShowClubs ($table, $sql, $results, $homeClub, $id, $clubName) {
require_once ("/home/mungojerry/public_html/phpforms/connect.inc");
$table = "clubs";
$sql = "SELECT * FROM $table WHERE county = '$county'";
$results = mysql_query($sql) or die("An error ocurred :".mysql_error());
echo "<form>";
printf("<select name=\"homeClub\">\n");
while ($row = mysql_fetch_array($results)) {
$id = $row["clubSeq"];
$clubName = $row["clubName"];
printf("<option SELECTED value=\"$id\">$clubName\n");
}
printf("</select>\n");
echo "<input type=submit value=confirm>
</form> ";
}
?>