Skip to content

Instantly share code, notes, and snippets.

@sampangrai
Created January 2, 2017 01:54
Show Gist options
  • Save sampangrai/a11fa6f0cb1656df2f01807e70e83147 to your computer and use it in GitHub Desktop.
Save sampangrai/a11fa6f0cb1656df2f01807e70e83147 to your computer and use it in GitHub Desktop.
form
<html>
<head>
<link rel="stylesheet" href="bootstrap/css/bootstrap.css">
<title> form </title>
</head>
<body>
<br>
<div class="container">
<div class="row">
<form action="formtable.php" method="post">
<div class="form-group">
<label for="">First name</label>
<input type="text" class="form-control" name ="name">
</div>
<div class="form-group">
<label for="">Last name</label>
<input type="text" class="form-control" name="lastname">
</div>
<div class="form-group">
<label for="">Email address</label>
<input type="email" class="form-control" name="email">
</div>
<div class="form-group">
<label for="">Phone no.</label>
<input type="mobile" class="form-control" name="phone">
</div>
<div class="form-group-sm">
<label for="">Massage</label>
<br><textarea name="comment" >
</textarea >
</div>
<div class="radio,checkbox">
<lable for="">Gender</lable>
<input type="radio" value="male" name="gender"> Male
<input type="radio" value="female" name="gender"> Female
<input type="radio" value="other" name="gender"> Other
</div>
<div class="form-group">
<lable for="">Hobbies</lable>
<input type="checkbox" value="cycling" check name="hobbies[]">Cycling
<input type="checkbox" value="hiking" check name="hobbies[]">Hiking
</div>
<div class="form-group">
<lable for="">Education</lable>
<select name="education">
<option value="s">S.L.C</option>
<option value="s">+2</option>
<option value="s">bachlor</option>
<option value="s">master</option>
</select>
<div/>
<div class="button, html input">
<input type="submit" value="submit">
</div>
</form>
</div>
</div>
</body>
</html>
<?php
$name= $_POST['name'];
$last= $_POST ['lastname'];
$email= $_POST ['email'];
$phone= $_POST['phone'];
$massage= $_POST['comment'];
$checkgender=$_POST['gender'];
$hobbies= $_POST ['hobbies'];
$education=$_POST['education'];
//echo "<pre>";
//print_r ($_POST);
//die;
?>
<!--if ($_POST=['gender']){-->
<!---->
<!--}-->
<html>
<head>
<link rel="stylesheet" href="bootstrap/css/bootstrap.css">
<title>
Table
</title>
</head>
<body>
<div class="container">
<h2>Form Data</h2>
<p>Here we get from data</p>
<table class="table">
<thead>
<tr>
<th>First name</th>
<th>Last name</th>
<th>Email address</th>
<th>Phone no.</th>
<th>Massage</th>
<th>Gender</th>
<th>Hobbies</th>
<th>Education</th>
</tr>
</thead>
<tbody>
<tr>
<td><?php echo $name;?></td>
<td><?php echo $last;?></td>
<td><?php echo $email;?></td>
<td><?php echo $phone;?></td>
<td> <?php echo $massage;?></td>
<td><?php echo implode(',' , $_POST['hobbies']); ?></td>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment