Berikut source code keseluruhan program:
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 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | <?php @$name1 = $_POST['name1']; @$address = $_POST['address']; @$phone = $_POST['phone']; @$text_area = $_POST['text_area']; @$gender = $_POST['gender']; @$child = $_POST['child']; @$job = $_POST['job']; @$option = $_POST['option']; @$life_description = $_POST['life_description']; @$birthday = $_POST['birthday']; @$format1 = date('d-m-Y', strtotime($birthday)); @$borrow = $_POST['borrow']; function age($age) { list($day,$month,$year) = explode("-", $age); $year_diff = date("Y") - $year; $month_diff = date("m") - $month; $day_diff = date("d") - $day; if($day_diff < 0 || $month_diff < 0) { $year_diff--; } return $year_diff; } ?> <!DOCTYPE HTML> <html> <head> <title>REGISTRATION FORM</title> </head> <body> <center> <h1>REGISTRATION FORM</h1> <br/> <form action="form_register.php" method="POST" enctype="multipart/form-data"> <table> <tr> <td>Name</td> <td>:</td> <td><input name="name1" type="text" value="<?php echo $name1; ?>"/></td> </tr> <tr> <td> Address </td> <td>:</td> <td> <textarea name="address" align="center" style="background-color: papayawhip; height: 150px; width: 250px"> <?php echo $address; ?> </textarea> </td> </tr> <tr> <td>Phone</td> <td>:</td> <td><input name="phone" value="<?php echo $phone; ?>" /></td> </tr> <tr> <td>Gender</td> <td>:</td> <td> <input name="gender" type="radio" required="" value="Male" <?php if($gender == "Male"){echo 'checked';} ?> />Male <input name="gender" type="radio" required="" value="Female" <?php if($gender == "Female"){echo 'checked';} ?> />Female </td> </tr> <tr> <td>Child</td> <td>:</td> <td><input name="child" type="number" value="<?php echo $child; ?>" /></td> </tr> <tr> <td>Job</td> <td>:</td> <td><input name="job" type="text" value="<?php echo $job; ?>" /></td> </tr> <tr> <td>Credit</td> <td>:</td> <td> <select name="option"> <option <?php if($option == 'Playing'){echo 'selected';} ?>>Playing</option> <option <?php if($option == 'Reading'){echo 'selected';} ?>>Reading</option> <option <?php if($option == 'Swimming'){echo 'selected';} ?>>Swimming</option> <option <?php if($option == 'Racing'){echo 'selected';} ?>>Racing</option> </select> </td> </tr> <tr> <td>Birthday</td> <td>:</td> <td> <input name="birthday" type="date" value=<?php echo $birthday; ?> /> </td> </tr> <tr> <td>Life Description</td> <td>:</td> <td> <textarea name="life_description" style="background-color: papayawhip; height: 150px; width: 250px"> <?php echo $life_description; ?> </textarea> </td> </tr> <tr> <td>Age</td> <td>:</td> <td><input name="age" value="<?php if(isset($birthday))echo age($format1); ?>" /></td> </tr> <tr> <td>Borrow</td> <td>:</td> <td><input name="borrow" type="checkbox" value="Document" <?php if($borrow == "Document"){echo 'checked';} ?> />Document <td><input name="borrow" type="checkbox" value="Electronic" <?php if($borrow == "Electronic"){echo 'checked';} ?> />Electronic <td><input name="borrow" type="checkbox" value="Vehicle" <?php if($borrow == "Vehicle"){echo 'checked';} ?> />Vehicle </td> </tr> <tr> <td> <label for="file">Filename</label> </td> <td>:</td> <td> <input type="file" name="file" id="file"><br> <?php @$operasi = strtolower($_POST['operasi']); if($operasi == "submit") { include 'upload_file.php'; } ?> </td> </tr> <tr> <td></td> <td></td> <td><input name="operasi" type="submit" value="SUBMIT"/><br/><br/><br/></td> </tr> </table> <?php if(isset($birthday)) { echo '<align:left>Name : '.$name1.'<br>Address : '.$address.'<br>Phone : '.$phone.'<br>Gender : '.$gender.'<br>Child : '.$child.'<br>Job : '.$job.'<br>Option : '.$option.'<br>Life Description : '.$life_description.'<br>Age : '.age($format1).'<br>Borrow : '.$borrow.'<align>'; } ?> </form> </center> </body> </html> |
Tampilan hasil akhirnya adalah sebagai berikut:
No comments:
Post a Comment