【发布时间】:2017-03-08 11:49:47
【问题描述】:
我的代码没有运行。如何在 php 上将变量作为 $_POST 传递。还是不可能?
原代码
foreach ($ret[0]->trends as $topic) {
$a = $topic->name;
$a = preg_replace("'", " ", $a);
$i++;
echo "
<tr>
<td class='hidden-xs'>$i</td>
<td>$topic->name</td>
<td><form role='form' action='/trgy/follow.php' method='get'>
<input type='text' name='$a' placeholder='follow number' >
<input type='submit' value='Follow'></form>
</td>
</tr>";
$count = htmlspecialchars($_POST[$a]);
if (!empty($_GET[$topic->name])) {
$ret1 = $topic->name;
$lasttweets = $connectionOauth->get('search/tweets', array('q' => $ret1, 'count' => $count));
}
}
别跑 - 这个有问题的行 - 我数不清
$a = $topic->name;
<input type='text' name='$a' placeholder='Number' >
$count = htmlspecialchars($_POST[$a]);
【问题讨论】:
-
那是什么代码? PHP 还是 HTML ?在这两种情况下,这里都是 标签 ?
-
使用php标签和表单
-
如果你使用正确的标记是可能的。
-
是的。 html和php