Wordpress添加Php的小帮助

时间:2015-01-08 17:01:05

标签: php wordpress

我在帖子和页面中安装了#34;允许PHP"插件在我的wordpress网站上。

我尝试在该页面上创建用于共享其Snapchat instagram帐户的页面,但某些代码未显示。关于php,我不太了解。你可以帮帮我吗?

http://tefo.tv/snap-2/

此代码发布在我的页面上;

[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>

这是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");
?>

感谢

1 个答案:

答案 0 :(得分:2)

您的[/ php]标记位于HTML代码之后。它应该在包括之后如此:

[php]      
include("add/connect.php");
[/php]

你的代码的其余部分不是php,所以它破坏了你的形式。