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.

Recommended Answers

All 3 Replies

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.

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.