Problem testing php forms in xampp

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Problem testing php forms in xampp

Postby jazkillingjoke » 24. December 2007 00:40

Hi

I am very new to php and xampp. I am practicing php feedback forms and all was fine until now.
I have argosoft free mail server installed to check that my feedback forms send me an email correctly and they do.
What I have been doing was testing for example "Feedback.html" with a script called "Sendmail.php" so 2 separate files and always get them to work under xampp.
I found a new tutorial and at one point the author says to place both files (The .html and the .php) together as one.
So I did and placed in my xampp htdocs folder but it doesn't run under http://localhost.
What happens is upon clicking "Submit" on the form I am being sent to the xampp homepage http://localhost/xampp instead of seeing the message that the form has been submitted.
I also check my argosoft email and nothing is in the inbox.

You can download the code here:

http://www.stefashwell.com/tutorials/entry/5/

Page 1 and 2 of the tutorial run fine as separated files but not together as one .php file found on page 3 of the tutorial.
(Scroll all the way down of page 3 of tutorial to download the code.)

I appreciate the help

Thanks a lot

Patrick
jazkillingjoke
 
Posts: 3
Joined: 24. December 2007 00:26

Postby Izzy » 24. December 2007 05:09

<form action="./" method="post">

This will do exactly what you are finding happens and loads the first index file found in a directory which is index.php of XAMPP.

You have to add the file name of the combined form script you created.
For example:
Code: Select all
<form action="./contact.php" method="post">


Just a / indicates to load the directory's index file and in your case:
http://localhost or http://localhost/ = XAMPP home page.
http://localhost/contact.php = your form that will on submit return to your form to do it's work.
HTH

TIP - always try and obfuscate any email addresses in a web page especially web forms, to help prevent spam-bots harvesting those addresses so they can sell those found addresses to spammers, who then fill the inbox of that address with unwanted spam - and I can assure you they do spider every known web site on the look out for those unenlightened web designers who still include open email addresses in their code.
Google will tell you how.

A free and perhaps the most advanced form processor ever produced, that has the most form features, including but not limited to email address hiding, I have ever seen, can be found here:
http://www.tectite.com/
Saves reinventing the wheel and comes highly recommended!


===========================================
1. The new DeskTopXampp Launch Control for XAMPP / XAMPPlite
Posted by Ridgewood available from Ridgewood'sDTX web site

2. Build Rich AJAX Applications - Faster
TIBCO General Interface Pro Edition but FREE and Open Source
Fully working with NO donations required to get a user/password
===========================================
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Postby KallistaAEnvarou » 24. December 2007 09:09

OR you can do <form action="" method="post"> to make tell the page running the form to process the information.

Also, make sure you test EVERY bit of incoming data. I could go to your site, copy the HTML, switch a few things around, tell my site to go to your page, have it run the server, and really mess up your database. So even if you have <select></select> HTML tags, make SURE you check them to make sure that the input data are valid. See http://php.net/in_array for a great function to use to validate select $_POST data.
KallistaAEnvarou
 
Posts: 126
Joined: 02. December 2007 17:33
Location: Cold Cold California

Izzy and KallistaAEnvarou

Postby jazkillingjoke » 25. December 2007 19:32

Hi

Thanks so much to the 2 of you for the solutions to my problem and the links too, I really appreciate it.
About me putting the present script on my site, know that I am just currently learning and would never put such an insecure script on my site.
I have studied plain xhtml forms, then I moved on to the mail() function of PHP and now I am going to start working on data validation and security.
I like to know how things work on my site even if the code isn't from me.

Thanks so much for getting me unstuck.

Patrick
jazkillingjoke
 
Posts: 3
Joined: 24. December 2007 00:26

Postby KallistaAEnvarou » 26. December 2007 00:33

Well, a huge, erroneous assumption that a lot of web designers make is that form data HAS to come from their scripts, when in reality they don't. I heard of one car-selling site that made that assumption, so someone got away with paying $4.95 for a Ferarri or some other expensive car.

Please look in to having <a href="http://validator.w3.org">valid (X)HTML pages</a>, especially if you want cross-browser compatability. Valid HTML forms are because each browser handles errors differently. Also, having pages without errors will VASTLY improve speed for your visitors.
KallistaAEnvarou
 
Posts: 126
Joined: 02. December 2007 17:33
Location: Cold Cold California

Postby jazkillingjoke » 26. December 2007 12:07

Thanks I will do.

Best regards

Patrick
jazkillingjoke
 
Posts: 3
Joined: 24. December 2007 00:26


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 23 guests