-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
103 lines (91 loc) · 2.58 KB
/
index.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<!DOCTYPE html>
<html lang="en">
<head>
<title>Pawan Xml</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="images/favicon.png">
</head>
<body>
<?php
$xml=simplexml_load_file("xml/base.xml") or die("Error: Cannot create object");
$d=$xml->children();
$totalradio=count($d->radio->option);
$totalcheckbox=count($d->checkbox->option);
$totaldropdown=count($d->dropdown->option);
?>
<form method="post" action="insert.php">
<input type="email" name="email" placeholder="please enter your mail" required>
<br>
<br>
<br>
<?php
for ($i=0; $i <=$totalradio-1; $i++) {
$c=$d->radio->option[$i];
$cc=$d->radio->selected[0];
if ("$cc" == "$c"){
?>
<input type="radio" checked="checked" id="<?php echo$d->radio->option[$i]; ?>" name="radio" value="<?php echo$d->radio->option[$i]; ?>">
<label for="<?php echo$d->radio->option[$i]; ?>" required> <?php echo$d->radio->option[$i]; ?></label><br>
<br>
<?php
}else{
?>
<input type="radio" id="<?php echo$d->radio->option[$i]; ?>" name="radio" value="<?php echo$d->radio->option[$i]; ?>" required>
<label for="<?php echo$d->radio->option[$i]; ?>"> <?php echo$d->radio->option[$i]; ?></label><br>
<br>
<?php
}}
?>
<br>
<br>
<br>
<?php
for ($i=0; $i <=$totalradio-1; $i++) {
$c=$d->checkbox->option[$i];
$cc=$d->checkbox->selected[0];
if ("$cc" == "$c"){
?>
<input type="checkbox" checked="checked" id="<?php echo$d->checkbox->option[$i]; ?>" name="check[]" value="<?php echo$d->checkbox->option[$i]; ?>">
<label for="<?php echo$d->checkbox->option[$i]; ?>"> <?php echo$d->checkbox->option[$i]; ?></label><br>
<br>
<?php
}else{
?>
<input type="checkbox" id="<?php echo$d->checkbox->option[$i]; ?>" name="check[]" value="<?php echo$d->checkbox->option[$i]; ?>">
<label for="<?php echo$d->checkbox->option[$i]; ?>"> <?php echo$d->checkbox->option[$i]; ?></label><br>
<br>
<?php
}}
?>
<br>
<br>
<br>
<label for="cars">dropdown list:</label>
<br><br>
<select name="dropdown" id="dropdown" required>
<?php
for ($i=0; $i <=$totalradio-1; $i++) {
$c=$d->dropdown->option[$i];
$cc=$d->dropdown->selected[0];
if ("$cc" == "$c"){
?>
<option selected value="<?php echo$d->dropdown->option[$i]; ?>"><?php echo$d->checkbox->option[$i]; ?></option>
<br>
<?php
}else{
?>
<option value="<?php echo$d->dropdown->option[$i]; ?>"><?php echo$d->checkbox->option[$i]; ?></option>
<?php
}}
?>
</select>
<br>
<br>
<br>
<button type="submit" name="spawan">
send data
</button>
</form>
</body>
</html>