View Full Version : Help with form submissions

07-15-2007, 05:21 PM
I am wanted to add a form so that when you submit it, it places that information on another page on the website. This may not be a javascript application but I wasnt sure where to start

Derek M

07-15-2007, 05:28 PM
Do you want the info to be just displayed, or are you going to end up saving the information. I believe you could just display the form values using javascript, but you would get better results using a server side language such as PHP or ASP. For PHP, you could use something like this (as a basis):



<form action="submit.php" method="POST">

Field 1: <input type="text" name="testField"> <br>
Field 2: <input type="text" name="testFieldTwo"> <br>
<input type="submit" value="Submit">



echo $_POST['testField'] . "<BR>" . $_POST['testFieldTwo'];


Note: The html in my first code example is not valid HTML, but simply an example of the form. In order for this to work properly, you will need to have PHP enabled on your server.

Hope this helps.

07-15-2007, 05:31 PM
Thanks for the quick reply. Yes I do want it displayed on the page. I thought php would work but I wasnt sure. Thank you I will try doing this!!!

Derek M

07-15-2007, 05:38 PM
you may be able to hlp me with something else or at least direct me to the right forum. I have about 500 pdf/microsoft word files on my website that I would like people to be able to search a word and find that particular file in my directory and display the results. What would I use for this?

Derek M

07-15-2007, 05:46 PM
You would want to use PHP (or; again, any server side language that can access the server's file system) and in turn using some form of Regular Expressions to search the filenames or those documents. As far as reading the files and searching through that, that would be harder to do. I recommend you look at this script:


and use that admin area to enter keywords, descriptions, etc of those files to somewhat make it easier on you.

Hope this helps.

07-17-2007, 04:55 AM
do i need to create a file called submit.php and if so what do i need to put in it
Derek M

07-17-2007, 02:23 PM
Well, no, but the page that displays what was submitted in the form must be a .php file and must be the file that the form submits to...

So, you would want to replace submit.php in the action of the form to the name of the php file you want to use.

In this file, you would want to use $_POST['name_of_form_field'], and any time you're writing php code it needs to be inside <?php ?> tags. Here's an example:

Name: <?php echo $_POST['name']; ?><br />
Email: <?php echo $_POST['email']; ?><br />
<!-- etc, etc, etc... -->

Now, you can get more complicated with the code. Using if/else statements to check if the field was filled in, then echoing accordingly. But this is just a basic introduction.