簡體   English   中英

<form action=“<?=$_SERVER['PHP_SELF']?> ” method =“ post”&gt;

[英]<form action=“<?=$_SERVER['PHP_SELF']?>” method=“post”>

我不明白為什么在下面的代碼中,從不執行else子句。 將顯示該表單,但是當我按下Submit按鈕時,什么也沒有發生。 有人可以幫忙嗎? 干杯。

<!doctype html>
<html>
<head>
    <meta charset = "utf-8">
    <title>Listing 12-3</title>
</head>

<body>
<h1>Query the Shop Database</h1>
<h3>Search for a Product</h3>
<p> Use a wildcard if necessary - % in front / behind text</p>
<?php
    tryagain:
    // Wait for submit
    if (!$_POST['submit']) {
?>
    <form action="<?=$_SERVER['PHP_SELF']?>" method="post">
        <p> Product Name: <input type ="text" name="product" /></p>
        <p><input type="submit" name = "submit" value = "Submit" /></p>
    </form>
<?php

        }
        else {
            // Connect to the Shop database

請更換

if (!$_POST['submit']) {

if (!isset($_POST['submit'])) {

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM