php file does not connect with the html file

i created a very simple html code to connect with a php file as follows ,


<!DOCTYPE html>
<html>
<body>

<h1>Welcome to MGW Computer Diploma Institute</h1>

<p>Select user type : </p>

<form action="Co_ordinater.php"method="POST">
	<input type="submit" name="Co_ordinater" value="CO_ORDINATER"><p>
</form >

<form action="Lecturer.php"method="POST">
	<input type="submit" name="Lecturer" value="LECTURER"><p>
</form >

<form action="Student.php"method="POST">
	<input type="submit" name="Student" value="STUDENT">
</form >


</body>
</html>

and the php file is as follows

[php]

<?php if(isset($_POST['Co_ordinater'])){ $con = mysql_connect("localhost","root",""); if (!$con){ die('Could not connect: ' . mysql_error()); } mysql_select_db("computer_diploma_institute", $con); $result = mysql_query("SELECT * FROM co_ordinaterview"); echo ""; while($row = mysql_fetch_array($result)){ echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; } echo "
LecId LecName LecTelNo Rank StId StName StTelNo Batch FollowingDiploma ModuleCode Title CreditValue DeptName Co_Ordinater
" . $row['LecId'] . "" . $row['LecName'] . "" . $row['LecTelNo'] . "" . $row['Rank'] . "" . $row['StId'] . "" . $row['StName'] . "" . $row['StTelNo'] . "" . $row['Batch'] . "" . $row['FollowingDiploma'] . "" . $row['ModuleCode'] . "" . $row['Title'] . "" . $row['CreditValue'] . "" . $row['DeptName'] . "" . $row['Co_Ordinater'] . "
"; mysql_close($con); } ?>

[/php]

When i run the php file it shows nothing.But if i remove
if(isset($_POST[‘Co_ordinater’])){} clause, it shows the content of the database table.When i run the html page and click thr co_ordinater button, Google chrome shows the php code…
Firefox shows a part of the php code.
:’(

please help me …
this is an urgent case :’( :’( :’( :’( :’(

What server are you running your form on?

xampp

Do you have it setup where html can parse php in your config file? I believe it something like this :

<IfModule mime_module>
# AddHandler allows you to map certain file extensions to "handlers": actions unrelated to filetype.
#php Setup
AddHandler application/x-httpd-php .html
AddType application/x-httpd-php .php
</IfModule>

I am a biginner in php and i don’t know how to use handlers…Aren’t they any simple ways to solve my problem

Hi,

Are your form fields correctly closed?, should have / at the end i belive.
So

Yes zammit1234 is correct your input fields are supposed to be closed as he showed. Check to see if that is the problem and if not then make sure that your html form file ends with .php and not .html so that you will not have to worry about handlers in you configuration file. I personally do not use xamp but it does have settings in the gui to make changes to your config file. Just make sure if you change the extension on the form to .php to change any links to the form to .php as well, otherwise you won’t be able to link to it.

Thank you all for paying attention on my problem !! :slight_smile:
As zammit1234 said i edited my file and as meTony said i saved my form file as .php
now it is working,My problem is sloved…Thank you all :-* 8)

Sponsor our Newsletter | Privacy Policy | Terms of Service