我在这里有一个表单,它假设将变量传递给另一个页面。但是当我在下一页上做的时候。
echo $_POST['firstname'];
echo $_POST['lastname'];
echo $_POST['address'];
该变量似乎是空的。我可以知道这样做的正确方法是什么?
上述表格:
<form enctype="multipart/form-data" method="POST" action="edit-profile.php" name="editform" id="editform"><br><br><br>
<div class="input-group"><span class="input-group-addon">First Name</span><input type="text" placeholder="<?php echo $fname;?>" class="form-control" name="firstname" id="firstname" /></div>
<div class="input-group"><span class="input-group-addon">Last Name</span><input type="text" placeholder="<?php echo $lname;?>" class="form-control"name="lastname" id="lastname" /></div>
<div class="input-group"><span class="input-group-addon">Address</span><input type="text" placeholder="<?php echo $address;?>" class="form-control"name="address" id="address" /></div>
<div class="input-group"><span class="input-group-addon">City</span><input type="text" placeholder="<?php echo $city;?>" class="form-control"name="city" id="city" /></div>
<div class="input-group"><span class="input-group-addon">Country</span><input type="text" placeholder="<?php echo $country;?>" class="form-control"name="country" id="country" /></div>
<div class="input-group"><span class="input-group-addon">Postcode</span><input type="text" placeholder="<?php echo $postcode;?>" class="form-control"name="postcode" id="postcode" /></div>
<div class="input-group"><span class="input-group-addon">Phone Number</span><input type="text" placeholder="<?php echo $phonenumber;?>" class="form-control"name="phonenumber" id="phonenumber" /></div>
<div class="input-group"><span class="input-group-addon">School ID</span><input type="text" placeholder="<?php echo $schoolid;?>" class="form-control"name="schoolid" id="schoolid" /></div>
<a class="btn btn-primary btn-lg btn-block btn-danger" href="javascript:;" onclick="parentNode.submit();">Edit</a>
</form>