我在PHP(自定义)中有一个while循环。它从wordpress网站获取所有数据(帖子)确定。但是表单(提交按钮)存在问题。实际上我想从选定的doamin生成链接,例如xyz.com和abc.com。选择域并单击提交按钮时,会创建帖子的链接,例如xyz.com/wordpress/?p=10。 zee.com/wordpress/?p=11 zee.com/wordpress/?p=12 请记住它创建所有帖子link.i想只用一个帖子做。所以请在这种情况下帮助我。 这是我的代码。
<?php
$sql = "select * from wp_tableposts where post_status = 'publish' AND post_type = 'post' Order by ID DESC;";
$res = mysql_query($sql);
while ($data = mysql_fetch_array($res))
{
$a = $data['guid'];//**** guid is link of posts
$urlparts = parse_url($a);
//**** This is removing the domain name of wordpress posts
$extracted = $urlparts['path'].'?'.$urlparts['query'] ;
//for example:www.wordpress.com/?p=10
//it gives: /?p=10
if (isset($data['guid']))
{echo $extracted; }
//**** This is removing the domain name of wordpress posts
echo'ID:'.$data['ID'].'';// it is id of wordpress post
echo'Post Contant:'.$data['post_content'].'';//*** it is contant of wordpress post
echo'Post Title:'. $data['post_title'].'';//*** it is title of wordpress post
echo'Link:'. $extracted.'';//*** this is the removed link of post
?>
<form method="GET">
<select name="subject">
<?php
//**** this is getting domains (xyz.com, abc.com)from another table
$sql1 = "select * from wp_domains ;";
$res1 = mysql_query($sql1);
while ($data1 = mysql_fetch_array($res1))
{
echo'
<option value="'. $data1['bb_domains'].'">'.$data1['bb_domains'].'</option>
';
}
?>
</select>
<input type="text" value="<?php echo $_GET['subject'] ;?><?php echo $extracted;?>" name="">
<input type="submit" name ="submit" >
</form>
<?php
}
?>