Hi there,
I want to ask a basic question. The form below is simple, name and age .... click submit and .....
<form action="result.php" method="POST">
Enter your name: <input type="text" name="name" />
Enter your age: <input type="text" name="age" />
<input type="submit" />
</form>
It ends up here ... on the result.php page
Welcome <?php echo $_POST["name"]; ?>.<br />
You are <?php echo $_POST["age"]; ?> years old!
That is fine ...... but i dont know what to do with my code ....
The user is meant to click on Submit and it takes them to result.php but the following IF Statement is run first !?!
Everything in the blue, red and green is fine
What should i put on the result.php page ??
if ($_REQUEST['submit'] == 'Submit') {
[COLOR=blue]$username = "username";
$password = "password";
$hostname = "localhost";
$dbh = mysql_connect($hostname, $username, $password)
or die("Unable to connect to MySQL");
print "Connected to MySQL<br>";
$selected = mysql_select_db("database",$dbh)
or die("Could not select my database");
print "Connected to database<br>";[/COLOR]
$clubID = $_POST['Clubno'];
$result=mysql_query("[COLOR=red]SELECT ClubName, DomesticLeague, TelePhoneNo, FaxNo, EmailAddress, Website, Groundno, YearEstablished, Status, ManagerNo, CoachNo FROM club WHERE Clubno=$clubID[/COLOR]");
while ($row = mysql_fetch_array($result,MYSQL_ASSOC)) {
[COLOR=green]echo "Club Name: $row[ClubName] <br> League: $row[DomesticLeague] <br> Telephone: $row[TelePhoneNo] <br> Fax No.: $row[FaxNo] <br> Email: $row[EmailAddress] <br> Website: $row[Website] <br> GroundNo: $row[GroundNo] <br> Established: $row[YearEstablished] <br> Status: $row[Status] <br> ManagerNo: $row[ManagerNo] <br> CoachNo: $row[CoachNo] <br>"; [/COLOR]
}
}
Can anyone help ...... i think it is a fairly straight forward problem if you know hat you are doing.