doujiao1984 2013-12-11 06:58
浏览 33
已采纳

HTML,css.php? 帮助如何将我的表单提交输出到网页而不是文本文件?

help i have bit knowledge in html,css but im kinda new to php forms,database,etc stuffs

my php is working well, when user click submit all forms goes to carlist.txt

but i want it output it through webpage html instead of .txt so i can view it online how i can able to do that?

and i dont want the users sees their submisions... only me can view it

html :

<html>
    <form action"awesome.php" method=get>

    First name: <input type="text" name="firstname"><br>
    blah.. blahh.
    <select name="cars">
      <option value="volvo">Volvo XC90</option>
      <option value="saab">Saab 95</option>
      <option value="mercedes">Mercedes SLK</option>
      <option value="audi">Audi TT</option>
      </select>
    <input type="submit" value="Submit">
    </form>
    etc. etc. blah blah
</html>

awesome.php:

<?php
header("Location: thanksforsubmiting.html");
$handle = fopen("carslist.txt", "a");
foreach($_GET as $variable => $value) {
fwrite($handle, $variable);
fwrite($handle, "=");
fwrite($handle, $value);
fwrite($handle, "
");
}
fwrite($handle, "
");
fclose($handle);
exit;
?> 

thanksforsubmitting.html:

<html>
<title>thank you</title>
<h1> <font color=red> 
thank you for submission </h1></font>

</html>

please be gentle to me im kinda newbie :)) TIA

  • 写回答

3条回答 默认 最新

  • drdl18946 2013-12-11 07:06
    关注

    at awesome.php write following code

    if(isset($_GET['submit'])){
        $firstName = $_GET['firstname'];
        $car = $_GET['cars'];
        echo $firstname;
        echo $car;
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料