嗨,有人可以指出我的方法出了什么问题。在我的代码中,我得到一个名为“sendme”的动态提交按钮,一旦出现,我想在“sendme”被触发后回显一条消息。为此,我包括 if(isset($_POST['sendme'])){...... 代码,但它似乎不是有效的代码。请指出我的理性在这种情况下应该如何改变。感谢您的关注!
<?php
if(isset($_POST['sendone'])){
$Q = $_POST['txt5'];
$con=mysql_connect('localhost','root') or die ("Server connection failure!");
$db=mysql_select_db('db_customer',$con) or die ("Couldn't connect the database");
$SQL="SELECT * FROM tbl_customer WHERE name='$Q'";
$run=mysql_query($SQL,$con) or die ("SQL Error");
$row=mysql_fetch_array($run);
if($row=="")
{
echo "No records found";
}
else
{
echo "<table border='1'>";
echo "<tr><td>"."Name :"."</td>";
echo "<td><input type='text' value=".$row['name'].">"."</td>";
echo "<td><input type='submit' id='sendme' name='sendme'></td>";
echo "</tr>";
echo "</table>";
}
}
else {
// here I'm trying to fire the populated submit button and echo cheers!
if(isset($_POST['sendme'])){
echo 'Cheers!';
}}
?>