[英]Little Help for Wordpress Adding Php
I installed "Allow PHP in Post and Pages" plugin on my wordpress site. 我在wordpress网站上安装了“允许PHP在Post and Pages中使用”插件。
I try to create page for sharing their snapchat instagram account on that page but some code are not shown. 我尝试在该页面上创建共享他们的instagram帐户的页面,但未显示某些代码。 I dont know much thing about php. 我对php不太了解。 could you help me? 你可以帮帮我吗?
http://tefo.tv/snap-2/ http://tefo.tv/snap-2/
This code is published on my page; 这段代码已发布在我的页面上;
[php]
include("share/connect.php");
[/php]
<div style="float:left">
<form action="http://tefo.tv/share/kaydet.php" method="post">
App: <select name="app">
<option value="Snapchat">Snapchat</option>
<option value="Instagram">Instagram</option>
<option value="Foursquare">Foursquare</option>
</select>
Username: <input type="text" name="username"><br>
Sex: <select name="sex">
<option value="Male">Male</option>
<option value="Female">Female</option>
</select>
<script>
$(function() {
$( "#datepicker" ).datepicker();
});
</script>
Birthday: <input type="text" id="datepicker" name="datepicker"><br>
Country: <select name="country">
<option value="Turkey">Turkey</option>
<option value="Rusia">Rusia</option>
<option value="USA">USA</option>
</select><br>
<input type="submit" VALUE="Gönder">
</form>
</div>
<!-- Main Part -->
<table style="margin-left:auto; margin-right:auto; width:auto; " border="1">
<tr style="background:#D5D4D2; color:#777777;" border="1">
<th>Application</th>
<th>Username</th>
<th>Sex</th>
<th>Age</th>
<th>Country</th>
<th>Date</th>
<th>Like</th>
<th>Unlike</th>
</table>
[php]
$list = mysql_query("select * from wp_snap") or die(bok);
while($list1 = mysql_fetch_array($list))
{
echo '<tr>';
echo '<td align="center">'.$list1['app'].'</td>';
echo '<td>'.$list1['username'].'</td>';
echo '<td>'.$list1['sex'].'</td>';
echo '<td>'.$list1['age'].'</td>';
echo '<td>'.$list1['country'].'</td>';
echo '<td>'.$list1['date'].'</td>';
echo '<td>'.$list1['like'].'<a href="#"><img src="share/like.png" width="10" height="10" alt="Örnek Resim"></a></td></br>';
echo '<td>'.$list1['unlike'].'<a href="#"><img src="share/dis.png" width="10" height="10" alt="Örnek Resim"></a></td></br>';
echo '</tr>';
}
[/php]
</table>
This is kaydet.php 这是kaydet.php
<?php
include("connect.php");
//Form post metoduyla gönderilen bilgileri alıp değişkenlere atayalım.
$app = $_POST['app'];
$username = $_POST['username'];
$sex = $_POST['sex'];
$datepicker = $_POST['datepicker'];
$country = $_POST['country'];
//Veritabanında bulunan 'defter' isimli tablonun 'defter_isim' ve 'defter_soyisim' alanlarına kayıt edelim.
$kaydet = mysql_query("insert into users (app, username, sex, age, country) values ('$app', '$username', '$sex', '$datepicker', '$country')") or die("Hata: kayıt işlemi gerçekleşemedi.");
header("refresh:0;url=index.php");
?>
thanks 谢谢
Your [/php] tag is after HTML code. 您的[/ php]标记位于HTML代码之后。 It should be right after the include like so: 应该在包含之后,就像这样:
[php]
include("add/connect.php");
[/php]
The rest of your code is not php so it is breaking your form. 您的其余代码不是php,因此它破坏了您的表单。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.