<a href=""> method post

时间:2016-01-13 23:45:38

标签: php mysql href

Is there a way to replicate this in <a href="blah.php">?

<form action="http://localhost/php/suburb_added.php" method="post">
<b>Add a New Suburb</b>
<p>Name:
<input type="text" name="suburb" size="30" value="" />
<input type="submit" id="submit" value="Submit" name="submit" />
</p>
</form>

in suburb_added.php... i have this to capture

if (!empty($_POST['suburb']))

To a table form....

<td align="left"><a href="suburb_added.php"><?php echo $row['id'];?></td>

how to create the items below from a table? The goal is when I click the result from <?php echo $row['id'];?>, I should be able to get the value of "id" and process it in suburb_added.php using similar to if (!empty($_POST['suburb']))

<form action="http://localhost/php/suburb_added.php" method="post">
<input type="text" name="suburb" size="30" value="" />

3 个答案:

答案 0 :(得分:0)

你有什么理解我不明白?我可以帮到你

 <?php
 if(!isset($_POST['submit'])){
 ?>
 <form action="" method="post" name="submit">
 <b>Add a New Suburb</b>
 <p>Name:
 <input type="text" name="suburb" size="30" value="" />
 <input type="submit" id="submit" value="Submit" name="submit" />
 </p>
 </form>
<?php
} else {
//paste here your code from http://localhost/php/suburb_added.php
echo "you doing post in this page.";
}
?>

答案 1 :(得分:0)

&#13;
&#13;
Parallel.For
&#13;
&#13;
&#13;

答案 2 :(得分:0)

更改PHP脚本,使其使用$_REQUEST而不是$_POST。此变量组合了$_POST$_GET的内容。然后你可以有一个像

这样的链接
<a href="suburb_added.php?suburb=<?php echo urlencode($row['name']) ?>"><?php echo $row['id'] ?></a>