hi, i have a form that i am using inside of my site.. and i just recently updated it... to use captcha...
all is well, its just that when i submit it.. it hides the rest of the page, and only shows the form, and says, form sent successfully.. i want it to stay where i have it included...

<?php include('http://site.com/folder/file.php'); ?>

how can i have it so, any errors (missing form data, wrong turing number it will display in the context to the rest of the page...)

easiest way to see what i am talking about is to look at it live...

http://naniboujou.com/retreat.php

scroll down, you will see the form, to test it, just leave all fields blank.. and hit submit.. you will see what i am talking about...
thanks

pj

Member Avatar

diafol

You're sending the form to the http://naniboujou.com/contacts/retreat.php file as opposed to http://naniboujou.com/retreat.php. It looks as though you've either included the form in your main page and are sending the data to the actual form itself. OR you've got two identical pieces of code, one in the main page and one in contacts/retreat.php.

As a rule, I always send form data to form handling file which processes the data and then either redirects to the original page or to a new one. Data can be stored temporarily by session variables.
For quick fixes, I store error messages, sent form data etc in sessions and redirect to the original form. Then I populate the form with the session data (and display an error if there is one). I then unset the session data.

thanks for responding.. those are two different files... retreat.php is the website, and contacts/retreat.php is the contact form, that pulls files from /contact dir...
nani/retreat.php is the guts, and i am inlcluding /contacts/retreat.php...

any way to keep it put?
thanks
pj

As Ardav said, you are getting exactly what you asked it to do. If the action on your form is contact/retreat.php then you will only get the contact form (and that is what is happening). You have two basic choices:
1. Make http://naniboujou.com/retreat.php the action on your form; or,

2. Create a whole new page that you will use as the action for the form with a layout the same as http://naniboujou.com/retreat.php