以下是我使用的HTML代码
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Registration</title>
<link href='http://fonts.googleapis.com/css?family=Josefin+Sans' rel='stylesheet' type='text/css'>
<style>
#container{
width:350px;
height:auto;
float:left;
font-family: 'Josefin Sans', sans-serif;
color:#82ABEA;
}
label{
display:block;
margin-bottom:5px;
}
fieldset{
border-color:#82ABEA;
}
button{
background-color:#900;
color:#FFF;
border:none;
box-shadow:none;
width:80px;
height:30px;
}
a{
color:#82ABEA;
}
</style>
</head>
<body>
<div id="container">
<p><b><a href="view_rec.php">View Record</a></b></p>
<form method="post" action="save_reg.php">
<fieldset>
<legend><b>Register Here</b></legend>
<label>First Name</label>
<input placeholder="Type Your First Name Here" type="text" name="firstname" size="25"/><br/><br/>
<label>Last Name</label>
<input placeholder="Type Your Last Name Here" type="text" name="lastname" size="25"/><br/><br/>
<label>Mobile Number</label>
<input placeholder="Type Your Mobile Number Here" type="text" name="mobilenumber" size="25"/><br/><br/>
<label>Email Id</label>
<input placeholder="Type Your Email ID Here" type="text" name="emailid" size="25"/><br/><br/>
<label>Gender</label>
<input placeholder="Select A Gender" type="radio" name="gender" value="Male"/>Male
<input placeholder="Type Your Mobile Number Here" type="radio" name="gender" value="Female"/>Female<br/><br/>
<label>Date Of Birth</label>
<select name="db">
<option selected>Month</option>
<option value="01">January</option>
<option value="02">February</option>
<option value="03">March</option>
<option value="04">April</option>
<option value="05">May</option>
<option value="06">June</option>
<option value="07">July</option>
<option value="08">August</option>
<option value="09">September</option>
<option value="10">October</option>
<option value="11">November</option>
<option value="12">December</option>
</select>
<select name="dbd">
<option selected>Day</option>
<option>01</option>
<option>02</option>
<option>03</option>
<option>04</option>
<option>05</option>
<option>06</option>
<option>07</option>
<option>08</option>
<option>09</option>
<option>10</option>
<option>11</option>
<option>12</option>
</select>
<select name="dby">
<option selected>Year</option>
<option>2005</option>
<option>2006</option>
<option>2007</option>
<option>2008</option>
<option>2009</option>
<option>2010</option>
<option>2011</option>
<option>2012</option>
<option>2013</option>
<option>2014</option>
<option>2015</option>
<option>2016</option>
</select><br/><br/>
<button><b>Submit</b></button>
</fieldset>
</form>
</div>
</body>
</html>
点击提交按钮我需要使用表单值生成发票** **有些人可以帮助我
答案 0 :(得分:-1)
您需要将save_reg.php文件设置为以下内容:
<html>
<body>
Your firstname <?php echo $_POST["firstname"]; ?><br>
Your lastname is: <?php echo $_POST["lastname"]; ?>
</body>
</html>
$ _ POST [&#34; name&#34;]在表单中检索具有已定义名称的DOM对象的值。
您还可以为更多可读代码设置变量:
$firstname = $_POST["firstname"];