提交时我需要在php中传递锚标记值

时间:2017-07-21 10:47:24

标签: php

while($row = mysql_fetch_assoc($req))
    {
        $user_from = $row['user_from'];
        echo "<form method='post'><a href='".$row['user_from']."' name='yo' value'".$row['user_from']."'>".$row['user_from']."</a> &nbsp";
        echo "<input type='submit' name='acc' value='Accept'> &nbsp <input type='submit' name='cancel' value='Reject Rrquest'></form> <br/><br/>";
    }
    if(isset($_POST['acc']))
    {
    }   
  

块引用

//在这里提交我需要显示相应的$ row [&#39; user_from&#39;]             价值

2 个答案:

答案 0 :(得分:-1)

如果您不想向用户显示文字字段,请使用<input type="hidden" name="whateveryouwant" />

试试这个:

while($row = mysql_fetch_assoc($req))
{
    $user_from = $row['user_from'];
    echo "<form method='post'><input type='hidden' name='user_from' value='".$row['user_from']."' /><a href='".$row['user_from']."' name='yo' value'".$row['user_from']."'>".$row['user_from']."</a> &nbsp";
    echo "<input type='submit' name='acc' value='Accept'> &nbsp <input type='submit' name='cancel' value='Reject Rrquest'></form> <br/><br/>";
}
if(isset($_POST['acc']))
{
    echo $_POST['user_from'];//echo the value of user_form
}   

答案 1 :(得分:-1)

-(void)webViewDidStartLoad:(UIWebView *)webView;
  

注意:在<?php while($row = mysql_fetch_assoc($req)) { $user_from = $row['user_from']; ?> <form method="post" action=""> <a href="<?php $row['user_from'] ?>" name="yo" value ="<?php $row['user_from'] ?>"> <?php $row['user_from'] ?> </a> <input type="submit" name="acc" value="Accept"> <input type="submit" name="cancel" value="Reject Rrquest"> </form> <php } ?> <?php if(isset($_POST['acc']) && !empty($_POST['yo'])) { $link = $_POST['yo']; // do what you want to do with this `url` } ?> echo中使用Html COde不要使代码复杂化。你可以打开While循环括号Php,然后关闭php {然后关闭你必须编写的简单html,所以只需避免在php echo中使用html代码