1
有人可以幫我請我從一週搜索和頁面發佈注意:未定義的索引:用戶名 C:\ Program Files \ EasyPHP-DevServer-14.1VC9 \ data \ localweb \ test用C密碼:在線.PHP 17公式html和php/pdo
注意:未定義指數\ Program Files文件\的EasyPHP-DevServer-14.1VC9 \ DATA \ localweb上線\ test.php的19
公告:未定義的索引:在電子郵件C:\ Program Files \ EasyPHP-DevServer-14.1VC9 \ data \ localweb \ test.php on line 21
我在代碼中找不到問題,請解釋我想要的RN謝謝
'<form action="test.php" method="post">
<input placeholder="username" type="text" name="username" ></input>
<input placeholder="password"type="password" name="password" ></input>
<input placeholder="email"type="email" name="email" ></input>
<input type="submit" value="OK"/></input>
</form>
<?php
$dsn = 'mysql:dbname=guyideas;host=localhost';
$user = 'root';
$password = '';
$dbh = new PDO($dsn, $user, $password);
$username = $_GET['username'];
$password = $_GET['password'];
$email = $_GET['email'];
$stmt = $dbh->exec('INSERT INTO `guyideas`.`users` (`username`, `password`, `email`) VALUES ("'.$username.'", "'.$password.'","email");');
?>'
沒有它不工作,因爲我嘗試這個「如果(isset($ _ POST [‘電子郵件’] )){ \t $ email = $ _GET ['email']; \t回聲「是」; }' –
@GuySharony - 看一下表單的**方法屬性**值 - 它設置爲'post' - 將其更改爲'get',然後您可以使用'$ _GET [「電子郵件引用數據「]' –
對不起,但它不工作我試試這個代碼----------------------------------- ----------- if(isset($ _ GET [「email」])){ \t $ email = $ _GET [「email」]; } else { \t echo「non」; } –