Вот весь код
Вопрос почему срабатывает else на if (@$_POST["submit"]) при нажатии button?
PHP:
скопировать код в буфер обмена
скопировать код в буфер обмена
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
- <title>Untitled Document</title>
- </head>
- <body>
- <?
- /* Переменные для соединения с базой данных */
- $hostname = "localhost";
- $username = "all_user";
- $password = null;
- $dbName = "666";
- /* Таблица MySQL, в которой хранятся данные */
- $userstable = "User";
- $userstable2 = "Message57";
- $userstable3 = "Netshop_OrderGoods";
- $userstable5 = "Message51";
- $db = mysql_connect ($hostname, $username, $password) OR DIE ("<font size='3' color='ff0000'><b>Не могу создать соединение!</b></font><br><font color='#0000ff'>Проверте переменные для соединения с базой данных</font>"); //так для локалки
- //mysql_select_db ($dbName, $db) OR DIE (mysql_error());
- $dis="disabled='disabled'";
- $article="";
- {
- $dis="disabled='disabled'";
- }
- else
- {
- $dis="";
- }
- echo "<pre>";
- echo "</pre>";
- print "
- <form action='' method='post' target='_self'>
- <input name='field_01' placeholder='ввидите артикул товара по 1C' type='text' size='40' value='$article'>
- <input type='submit' value='Найти'>
- <br><br>
- </form>";
- if (@$_POST["submit"])
- {
- $article = @$_POST["field_01"];
- $result_01 = mysql_query ("SELECT $userstable2.Message_ID, $userstable2.Price FROM $userstable2 WHERE $userstable2.Message_ID='$article'", $db);
- print "$ID";
- print "вывод (если нажали баттон) $article ".$article."end out";
- }
- else
- {
- $article = @$_POST["field_01"];
- print "$ID";
- print "вывод $article (если POST не сработал или баттон не нажался O_o!)= ".$article." /end out";
- }
- ?>
- </body>
- </html>