簡體   English   中英

簡單的聯系表格不起作用

[英]Simple contact form not working

我正在嘗試制作一個簡單的聯系表單 ,我有兩個文件,contact.php和index.php

我希望這兩個選項會出現在我的index.php文件中的“查詢類型 ”中,這些選項是我放在contact.php文件中的數組中的,如下所示:

 <?php class Contact{ public static $types = array( 1 => 'Product enquiry', 2 => 'Billing enquiry', 3 => 'Support enquiry' ); } 

我還在index.php文件中包括了contact.php:

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

但是經過大量嘗試,我在下拉字段中看不到任何選項,因此可能與連接有關嗎? 當我嘗試php代碼時,是否應該將其放入Xampp之類的本地服務器中?

這是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> 

*很抱歉,如果有一點混亂,但我正在盡力而為(-:

如果使用XAMPP,則將所有文件放在htdocs文件夾下。 你已經提到

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

-指本地文件路徑。

暫無
暫無

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

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