Head First PHP&MySQl第二章代码
发布时间:2021-08-28 03:48:05 所属栏目:大数据 来源: https://www.jb51.cc
导读:PHP: htmlhead title外星人绑架了我--报道一起绑架/title/headbody h2外星人绑架了我--报道一起绑架/h2 ?PHP $name = $_POST['name']; $when_it_happened = $_POST['whenithappened']; $how_long = $_POST['howlong']; $how_many = $_POST['howmany']; $alie
PHP: <html> <head> <title>外星人绑架了我--报道一起绑架</title> </head> <body> <h2>外星人绑架了我--报道一起绑架</h2> <?PHP $name = $_POST['name']; $when_it_happened = $_POST['whenithappened']; $how_long = $_POST['howlong']; $how_many = $_POST['howmany']; $alien_description = $_POST['aliendescription']; $what_they_did = $_POST['whattheydid']; $fang_spotted = $_POST['fangspotted']; $email = $_POST['email']; $other = $_POST['other']; //DatabaseAddress:数据库地址;username:用户名;command:口令;DatabaseName:数据库名字; $dbc = MysqLi_connect('DatabaseAddress','username','command','DatabaseName') or die('连接MysqL错误.'); //参数与数据库的表单的列有关 $query = "TNSERT INTO TableName (name, when_it_happened, how_long, ". "how_many, alien_description, what_they_did, fang_spotted, other, email)". "VALUES (' $name, $when_it_happened, $how_long, $how_many, ". "$alien_description, $what_they_did, $fang_spotted, $other, $email)"; $result = MysqLi_query($dbc, $query) or die('查询数据库错误。'); MysqLi_close($dbc); echo '非常感谢你提交的表单 ' . '<br/>'; echo '你在什么时候被绑架的?' . $when_it_happened . '<br/>'; echo '你被带走了多长时间? ' . $how_long . '<br/>'; echo '外星人的数量是多少? ' . $how_many . ' <br/>'; echo ' 外星人的外貌是什么样? ' . $alien_description . '<br/>'; echo '外星人做了什么? ' . $what_they_did . '<br/>'; echo 'Fang在不在那里? ' . $fang_spotted . ' < br/>'; echo '其它内容: ' . $other . '<br/>'; echo '你的邮箱地址是: ' . $email . '<br/>'; ?> </body> </html> ? (编辑:北几岛) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |