0

Hi.. gud day.. i'm a beginner in php programming, i just started today and i want to ask a question about the use of the "isset()" function. the code in the .php file comes like this:

<?php
	if(isset($_POST["RegisterButton"])) 
	{
		mysql_connect("localhost","root","") or die (mysql_error());
		echo "Connected to mysql";
		mysql_select_db("myDatabase") or die (mysql_error());
		echo "Connected to Database";
	}
?>

and here is the .html file:

<html>
<head>
<body>
<center><font size = "15">Registration Form</font></center><br>
	<font style = "Comic Sans MS">**Fill up the following**</font><br><br>
	<form action = "test1.php" method = "post">
	<table width = "80%" border = "0">
		<tr>
			<td width = "8%">First Name:</td><td width = "8%"><input type = "text" name = "fname" /></td>
			<td width = "8%">Last Name:</td><td width = "8%"><input type = "text" name = "lname" /></td>
			<td width = "8%">Middle Name:</td><td width = "8%"><input type = "text" name = "mname" /></td>
		</tr>

		<tr>
			<td width = "8%">Age:</td><td width = "8%"><input type = "text" name = "age" /> </td>
			<td width = "8%">Address:</td><td width = "8%"><input type = "text" name = "address" /></td>
		</tr>
		<tr>
			<td colspan = "2"><input type = "submit" value = "Register" name = "RegisterButton" /></td>
		</tr>
	</table>
	</form>
</body>
</html>

If i click the Register Button in the .html file, the line
-- echo "Connected to mysql" and
-- echo "Connnected to Database" won't be printed.

Thanks in advance for your help.

2
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by ShawnCplus
0

Firstly, toss an echo at the top of your php file to make sure you're even touching that file. Based on your HTML file you may not, type = "submit" those spaces may or may not be killing the submit button.

0

wooaahh! that was quick.. i didn't know that, type = "submit" and type="submit" would be different, i thought it works just the same.

so what's the use of the isset() function again? :D

thanks anyway.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.