2015-05-19 38 views
1

我使用xampp(apache)php,並且想要在本地測試我的html電子郵件表單。當我使用這個actionform標記它的工作(我得到一個「感謝您與我們聯繫」確認):不能在本地主機上運行xampp php來測試html電子郵件表格

<form id="contactus" action="http://www.html-form-guide.com//files/contact-form/simple-form-1-1/contactform.php" novalidate method="post" accept-charset="UTF-8" >

注:此網址在action使用從網站中獲得的指導郵件表單設計。

但我無法正確編碼action讓它運行使用我的本地.php文件。我已經嘗試了所有的這些(基於計算器職位的建議),還沒有工作:

  1. action="contactform.php"
  2. action="http://localhost/contactform.php"
  3. action="<?php echo site_url('contactform'); ?>"

我有我的.PHP和.html電子郵件文件在同一個文件夾中。該目錄路徑是:C:\ XAMPP \ htdocs中\ contactform.php & C:\ XAMPP \ htdocs中\聯繫us.html

的方式,我測試使用CNTRL + O打開與我們聯繫Chrome中的.html。我可以看到電子郵件表格。當我使用action="http://www.html-form-guide.com//files/contact-form/simple-form-1-1/contactform.php"時,輸入姓名,電子郵件地址和虛擬消息時有效,但不能與上面的1,2和3一起使用。感謝您的任何幫助。

最後,我沒有問題使用localhost/contactform.php打開.php文件。

更新:如果這有助於下面的腳本從我XAMP控制面板: 22::37:25 [main] Initializing Control Panel 22::37:25 [main] Windows Version: Windows 8 64-bit 22::37:25 [main] XAMPP Version: 5.6.8 22::37:25 [main] Control Panel Version: 3.2.1 [ Compiled: May 7th 2013 ] 22::37:25 [main] You are not running with administrator rights! This will work for 22::37:25 [main] most application stuff but whenever you do something with services 22::37:25 [main] there will be a security dialogue or things will break! So think 22::37:25 [main] about running this application with administrator rights! 22::37:25 [main] XAMPP Installation Directory: "c:\xampp\" 22::37:25 [main] Checking for prerequisites 22::37:25 [main] All prerequisites found 22::37:25 [main] Initializing Modules 22::37:25 [Apache] Initializing module... 22::37:25 [Apache] Checking for module existence... 22::37:25 [Apache] Checking for required tools... 22::37:25 [Apache] Checking for service (name="Apache2.4"): Service not installed 22::37:25 [Apache] Service Path: Service Not Installed 22::37:25 [Apache] Checking default ports... 22::37:25 [mysql] Initializing module... 22::37:25 [mysql] Checking for module existence... 22::37:25 [mysql] Checking for required tools... 22::37:25 [mysql] Checking for service (name="mysql"): Service not installed 22::37:25 [mysql] Service Path: Service Not Installed 22::37:25 [mysql] Checking default ports... 22::37:25 [filezilla] Initializing module... 22::37:25 [filezilla] Checking for module existence... 22::37:25 [filezilla] Checking for required tools... 22::37:25 [filezilla] Checking for service (name="FileZillaServer"): Service not installed 22::37:25 [filezilla] Service Path: Service Not Installed 22::37:25 [filezilla] Checking default ports... 22::37:25 [mercury] Initializing module... 22::37:25 [mercury] Checking for module existence... 22::37:25 [mercury] Checking for required tools... 22::37:25 [mercury] Checking default ports... 22::37:25 [Tomcat] Initializing module... 22::37:25 [Tomcat] Checking for module existence... 22::37:25 [Tomcat] Checking for required tools... 22::37:25 [Tomcat] Checking for service (name="Tomcat7"): Service not installed 22::37:25 [Tomcat] Service Path: Service Not Installed 22::37:25 [Tomcat] Checking default ports... 22::37:25 [main] Enabling autostart for module "Apache" 22::37:25 [main] Enabling autostart for module "MySQL" 22::37:25 [main] Starting Check-Timer 22::37:25 [main] Control Panel Ready 22::37:26 [Apache] Autostart active: starting... 22::37:26 [Apache] Checking default ports... 22::37:26 [Apache] Attempting to start Apache app... 22::37:26 [Apache] Executing "c:\xampp\apache\bin\httpd.exe" 22::37:26 [Apache] Return code: 0 22::37:26 [mysql] Autostart active: starting... 22::37:26 [mysql] Checking default ports... 22::37:26 [mysql] Attempting to start MySQL app... 22::37:26 [mysql] Executing ""c:\xampp\mysql\bin\mysqld.exe" --defaults-file="c:\xampp\mysql\bin\my.ini" --standalone" 22::37:26 [mysql] Return code: 0 22::37:26 [Apache] Status change detected: running 22::37:26 [mysql] Status change detected: running

+0

第一個選項應該工作 – gbestard

+0

注意'zzz'文件夾... – Masiorama

+0

如果您直接使用chrome打開.html文件,它不會工作。啓動服務器。並轉到localhost/contactus.html – Mathivanan

回答

0
  1. 是您的服務器啓動的?
  2. 您是否使用http://localhost訪問您的頁面?
  3. 你能通過瀏覽器直接訪問你的php文件嗎?
  4. 如果您使用的是linux,您的apache用戶是否已經讀取並執行這些文件的訪問權?
+0

要回答您的問題:1)我的XAMPP控制面板v3.2.1顯示模塊Apache和MySQL正在運行; 2)按「頁面」是否指「聯繫我們.html」?如果是這樣,是的; 3)是的。在瀏覽器中,我在url窗口中輸入「localhost/zzz/contactform.php」; 4)Windows 8. – JMM

+0

此外,根據Mathivanan的建議,我已經在URL窗口中輸入了:localhost/zzz/Contact us.html。當我完成電子郵件表單並提交時,我現在可以看到電子郵件表單的.php版本,它也有一個提交按鈕。我再次提交提交,但沒有任何反應,除了我在屏幕上看到「等待本地主機......」。 – JMM

+0

我在XAMPP控制面板中看到了這一點:「你沒有使用管理員權限運行!這對大多數應用程序都有效,但是當你使用服務進行某些操作時,將會有安全對話或者事情會中斷!所以想想運行這個應用程序與管理員權限!「這是否傷害了我的電子郵件表單&php的使用?如果是,我如何獲得管理員權限? – JMM

相關問題