JMM
JMM

Reputation: 87

Cannot run xampp php on localhost to test html email form

I am using xampp (apache) php and want to test my html email form locally. When I use this action in the form tag it works (I get a "thanks for contacting us" confirmation):

<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" >

Note: This url used in action was obtained from an a website that guides email form design.

But I cannot code action correctly to get it to run using my local .php file. I've tried all of these (based on suggestions in stackoverflow posts), none have worked:

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

I have my .php and .html email files in the same folder. The directory path is: c:\xampp\htdocs\contactform.php & c:\xampp\htdocs\Contact us.html

The way I am testing is using Cntrl+O to open the Contact us.html in Chrome. I can see the email form. When I input name, email address and a dummy message it works when I use action="http://www.html-form-guide.com//files/contact-form/simple-form-1-1/contactform.php" but not with 1, 2 and 3 above. Thank you for any help.

Lastly, I have no problem opening the .php file using localhost/contactform.php.

Update: If this helps here's a script from my XAMP Control Panel: 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

Upvotes: 1

Views: 2374

Answers (1)

Fabrice Kabongo
Fabrice Kabongo

Reputation: 668

  1. is your server launched?
  2. are you accessing your page using http://localhost?
  3. can you access directly to your php file via the browser?
  4. if you are using linux, do your apache user have read and execute access right on those file?

Upvotes: 1

Related Questions