Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: PHP MySQL
here the code..
 
for homepage
<html>
<head>
<h3>
College fest Organising Group
</h3></head>
<body>
<h5>Register, n be a part of the group!</h5>
<a href="registration.php"> Register </a></br>
<h5>Login, as a member</h5>
<a href="login.php"> Login </a></br>
</body>
</html>
 

for registration page...
<html>
<head><title> Registration Form</title></head>
<body>
<h3> Register here!</h3>
<form name="registration" method="POST" action="">
<table>
<tr>
<td>Name:</td>
<td><input type="text" name="Name" ></td>
</tr>
<tr>
<td>Department:</td>
<td><input type="text" name="Department" ></td>
</tr>
<tr>
<td>Roll_No:</td>
<td><input type="text" name="Roll_No" ></td>
</tr>
<tr>
<td>Telephone_No:</td>
<td><input type="text" name="Telephone_No" ></td>
</tr>
<tr>
<td>CGPA:</td>
<td><input type="text" name="CGPA" ></td>
</tr>
<tr>
<td>Committee(Choose only 1):</td>
<td><select name="Committee">
<option value="D"> Dance--D </option>
<option value="DR"> Drama--DR </option>
<option value="M"> Music--M </option>
<option value="H"> Hospitality--H </option>
<option value="S"> Stage--S </option>
</select>
</td>
</tr>
<tr>
<td>Password:</td> <td><input type="Password" name="Password" ></td>
</tr>
</table>
<input type="submit" value="Submit">
</form>
<p> Thank you! </p>
</body>
</html>
 

for connecting the page to database....
<?php
$name=$_POST['Name'];
$department=$_POST['Department'];
$roll_No=$_POST['Roll_No'];
$telephone_No=$_POST['Telephone_No'];
$CGPA=$_POST['CGPA'];
$committee=$_POST['Committee'];
$password=$_POST['Password'];
mysql_connect("localhost", "root", "mysql11") or die(mysql_error());
echo "Connected to MySQL<br/>";
mysql_select_db("test") or die(mysql_error());
echo "Connected to Database";
$result=mysql_query("Insert into committee Values(\"$name\",\"$department\",\"$roll_No\",\"$telephone_No\",\"$CGPA\",\"$committee\",\"$password\")");
echo "Thankyou!";
?>
 

please go through the code...and tell me what's the mistake?
Posted 23-Jul-12 1:07am
Smrng303
Comments
AlluvialDeposit at 23-Jul-12 6:21am
   
is there any errors or exceptions?
Sebastian T Xavier at 23-Jul-12 6:44am
   
This is just a code dump
Wes Aday at 23-Jul-12 9:11am
   
"please go through the code"... no thanks I have my own job to do. It is up to you to debug your own code.
ryanb31 at 23-Jul-12 10:31am
   
What's the problem?
Sandeep Mewara at 23-Jul-12 12:06pm
   
A guess game?
Smrng at 7-Aug-12 1:09am
   
Wes Aday If it wasn't your job why did you even reply.
I am a beginner and can't to this on my own.That's why asked for your help.
Thanks anyway!!

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

h3 tag does not belong in the head. The form tag requires the action attribute I believe. There is painfully obvious SQL injection going on here. The attribute type Password is invalid, it should be password. You spelled organizing wrong. Use of mysql_connect is discouraged. Use of mysql_select_db is discouraged. Use of mysql_query is discouraged. Should be <br /> not </br>. Thank you is two words. n isn't a word. I wont even get into validation or the fact that your form response isn't a web page.
  Permalink  
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 406
1 /\jmot 180
2 Suraj Sahoo | Coding Passion 170
3 BillWoodruff 159
4 Afzaal Ahmad Zeeshan 154
0 OriginalGriff 8,344
1 Sergey Alexandrovich Kryukov 7,407
2 DamithSL 5,634
3 Maciej Los 5,024
4 Manas Bhardwaj 4,986


Advertise | Privacy | Mobile
Web03 | 2.8.1411023.1 | Last Updated 27 Jul 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100