-
Notifications
You must be signed in to change notification settings - Fork 0
/
msignup2.php
executable file
·75 lines (59 loc) · 2.09 KB
/
msignup2.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php
if(isset($_GET["butNext"]))
{
if($_GET["txtRegno"]=="" or (!isset($_GET["radVehicle"])) or $_GET["txtModel"]=="" or $_GET["txtColour"]=="" )
{
echo "<script type=\"text/javascript\"> alert(\"All fields compulsory\");</script>"; //Empty field validation
$flag=0;
}
else
{
mysql_connect("localhost","pool","pool") or die(mysql_error()); //establish database connection
mysql_select_db("pool") or die(mysql_error());//select pool database
$regno=$_GET["txtRegno"];
$type=$_GET["radVehicle"];
$model=$_GET["txtModel"];
$colour=$_GET["txtColour"];
if($type=="two")
$type=2;
else
$type=4;
$getregno=mysql_query("Select * from vehicle where reg_no='$regno'");
if(mysql_num_rows($getregno)!=0)
{
echo "<script type=\"text/javascript\"> alert(\"User with the given vehicle registration number already exists\");</script>";
$flag=0;
}
$mid1=$_SESSION['mid'];
//echo "This is the troubling thing".$mid1.$_SESSION['mid'];
if($flag==1)
{
mysql_query("insert into vehicle values ('$regno','$model','$colour','$type','$mid1')") or die("Database insertion error");
session_destroy();
header("Location:signup3.php?mid=$mid1");
}
}
}
?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="signup.css" />
<title>
frmSignup_2
</title>
</head>
<body>
<h1>Your wheels?</h1>
<form method="get" action="signup2.php">
<p><label for="regn no">Registration number:</label><input title="registration number" type="text" maxlength="10" name="txtRegno"></p>
<br>
<p><label for="veh type">Vehicle type:</label>2-wheeler<input type="radio" name="radVehicle" value="two">4-wheeler<input type="radio" name="radVehicle" value="four"></p>
<br>
<p><label for="model">Model:</label><input title="model" type="text" name="txtModel"></p>
<br>
<p><label for="colour">Colour:</label><input title="colour" type"text" name="txtColour"></p>
<br>
<p class="submit"><input type="submit" value="Next" name="butNext"></p>
</form>
</body>
</html>