How do i connect php form code to my website?
-
Hi I have made a website and have added a form to it but need to get it to work. I have got a php script for a form but dont know how to connect the form to the PHP code to get it to work?? also how do i test the code to make sure it works?? help
-
Answer:
Usually you call it by putting the php file in the action attribute like this... <form action="myphpfile.php" method="post"> and just change myphpfile.php to the name and location of your php file that will process the form. you need a server with PHP installed on it to test it... you can download WAMP if you want to test it offline on your computer
Monty12 at Yahoo! Answers Visit the source
Other answers
1) You need WAMP to run PHP. Its server side not browser side. 2) Put your HTML form on 1 page and your PHP on another in the form opening tag in the action="" write the name of your php file. 3) To send form data to a file we use 1 of 2 methods GET or POST. Mainly POST. ------------------------------------- HTML FORM (form.php) ------------------------------------- <form method="post" action="form_process.php"> <input type="text" name="client_name" /> </form> ------------------------------------- The name="" is crucial this is how PHP knows what its pulling. Now the PHP script ------------------------------------- form_process.php ------------------------------------- <?php $client_name = $_POST['client_name']; echo $client_name; ?> ------------------------------------ PHP now has the form data and can display it as I have shown. You can now do what you want with the data submit it to a database perform other things to it. Good luck if you want further help get in touch.
Nik
Related Q & A:
- How can I add a HTML code to My Yahoo homepage?Best solution by Yahoo! Answers
- How do I use a genetic code table?Best solution by biology.about.com
- How do I put an html code in a scroll box?Best solution by html.am
- How to copy and paste a code on my website?Best solution by eHow old
- How can can i connect on msn from an other website?
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.