我很難嘗試將php代碼集成到我在wordpress上創建的表單中。我嘗試了3個不同的PHP插件無濟於事。這裏是html和css。有沒有人有任何想法,我應該把WordPress的WordPress,我應該如何通過形式中的「行動」正確地稱呼它?如何將php添加到wordpress表單
CSS:
<style>
input[type=text], input[type=number], select[name=province]{ font-family: arial; width:100%;
border: 1px solid #E5E5E5; padding: 10px 20px;}
input[name=ffirstname] {width:49%; margin-right:1%; }
input[name=lastname] {width:49%; margin-left:1%; }
input[name=address] {width:65.6667%; margin-right:1%; }
input[name=unit] {width:32.3337%; margin-left:1%; }
input[name=city] {width:49%; margin-right:1%; }
select[name=province] {width:24%; margin-left:1%;}
input[name=postal] {width:24%; margin-left:1%; }
input[name=email] {width:49%; margin-right:1%; }
input[name=phone] {width:49%; margin-left:1%;}
input[class=submit] {
background-color: #f05a28;
color: white;
padding: 8px 20px;
margin-left: 85%;
border-radius: 4px;
border: none; !important;
outline: none; !important ;
cursor: pointer;
box-shadow: none; !important;
}
</style>
HTML:
<form name"infoform" method="post" action="form-to-email.php" >
<br><input type="text" name="ffirstname" placeholder="First Name"/><input type="text" name="lastname" placeholder="Last Name"/>
<br><br><input type="text" name="address" placeholder="Address"/><input type="text" name="unit" placeholder="Unit"/></br>
<br><input type="text" name="city" placeholder="City"/><select name="province" form="form1">
<option value="ab">AB</option>
<option value="BC">BC</option>
<option value="BC">MB</option>
<option value="NB">NB</option>
<option value="NL">NL</option>
<option value="NS">NS</option>
<option value="ON">ON</option>
<option value="PE">PE</option>
<option value="QC">QC</option>
<option value="SK">SK</option>
</select><input type="text" name="postal" placeholder="Postal Code"/></br>
<br><input type="text" name="country" placeholder="Country"/></br>
<Br><input type="text" name="email" placeholder="Email"/><input type="number" name="phone" placeholder="Phone#"/></br>
<br> <br><input type="submit" value="Next"/>
PHP:
<?php
$name = $_POST['ffirstname'];
$email = $_POST['lastname'];
$message = $_POST['address'];
$to = "[email protected]";
$subject = "My contact form";
$body = " You have received a new";
mail($to,$subject,$body);
?>
我不想使用聯繫人7或任何其他插件,我希望能夠以非常特別設置表的格式。如何將php放入wordpress的頁眉或頁腳? –
我更新了答案。 –
我在哪裏可以找到這些PHP文件完全在WordPress?我是否通過cPanel並在文件夾中找到它?如果是的話,它將位於何處。 –