douduocuima61392 2015-05-08 13:44
浏览 31

简单的联系表格不起作用

I'm trying to make a simple contact form, I have two files, contact.php and the index.php

I want that couple of options will appear in my index.php file in the "Enquiry type" those options i put in array in th contact.php file like this:

<?php

class Contact{

    public static $types = array(

    1 => 'Product enquiry',
    2 => 'Billing enquiry',
    3 => 'Support enquiry'


        );
}

I have also included contact.php in the index.php file:

<?php require_once('file:///D:/Simple%20Contact%20Form/Liberay/Contact.php'); ?>

But after lot of attempts, I cant see in the drop down field any of that options, so probably its something with connection maybe? And when I'm trying out php code, should i have to put it in local server like Xampp?

this is the full code from index.php:

<?php require_once('file:///D:/Simple%20Contact%20Form/Liberay/Contact.php'); ?>

<!DOCOTYPE html>
<html>
<head>
 <meta charset="utf-8" />
 <meta name="viewport" content="width=device-width" />
 <title>Simple contact form with PHP</title>
 <link rel="stylesheet" type="text/css" href="file:///D:/Simple%20Contact%20Form/CSS/core.css"/>

</head>

<body>
<form method="post" id="formContact" class="large-8 large-centered columns custom">   
<fieldset>

<legend>Simple Contact Form with PHP</legend>

<div class="large-6 columns">

    <label for="first_name">First name: *</label>
    <input 
    type="text"
    name="first_name"
     id="first_name"
     placeholder="Your first name"/>
 </div>

 <div class="large-6 columns">

    <label for="last_name">Last name: *</label>
    <input type="text"
    name="last_name"
     id="last_name"
     placeholder="Your last name"/>
 </div>

 <div class="large-6 columns">

    <label for="first_name">Email address: *</label>
    <input type="email"
    name="email"
     id="email"
     placeholder="Your Email address"/>
 </div>

<div class="large-6 columns">

    <label for="type">Enquiry type: *</label>
    <select
     name="type"
      id="type">
    
    <option value="">Select one</option>

   <?php if (!empty(Contact::$types)) { ?>

   <?php foreach(Contact::$types as $id => $type) { ?>

   <option value="<?php echo $id; ?>"><?php  echo $type; ?></option>
   <?php } ?>

    </select>

</div>
<div class="large-12 columns">
    <label for="enquiry">Enquiry: *</label>
    <textarea name="enquiry" id="enquiry" placeholder=" Your message"></textarea>
</div>

<div class="large-12 columns">

<button class="button small">Send message</button>

    </div>


</fieldset>

</form>

<script src="file:///D:/Simple%20Contact%20Form/jquery.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="file:///D:/Simple Contact Form/js/core.js"></script>

</body>




</html>

*Sorry if there is little bit of mess, but I'm trying my best (-:

</div>
  • 写回答

1条回答 默认 最新

  • dongxindu8753 2015-05-08 13:48
    关注

    If you are working with XAMPP, then put all your files under htdocs folder. You have mentioned

    <?php require_once('file:///D:/Simple%20Contact%20Form/Liberay/Contact.php'); ?>
    

    - which refers to local file path.

    评论

报告相同问题?

悬赏问题

  • ¥15 基于单片机的靶位控制系统
  • ¥15 AT89C51控制8位八段数码管显示时钟。
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错