results from form with PHP

  samwise101 16:54 26 Apr 2006
Locked

This is obviously a silly question as i cannot find the answer anywhere, but hope someone here can help!!!

I have created a form on my website with checkboxes, radio and text boxes and several people have filled it in & submitted it. Where do I get these submitted results from. Should they be in a file somewhere or on my server (if so how do i access them, or sent via e-mail. I have all the variables set up with $_POST and have PHP with my host

Please help.....step by step if poss

Thanks

  harristweed 17:20 26 Apr 2006

A form will have an Action and a Method.

<form action="mailform.php" method="post">

The action is where the variable value pairs are sent, when the submit button is pressed. This can be another webpage or a script that ‘sends’ the information by email.

A value pair is the name of the text box of selector and the value it contains. i.e.
If you had a text box named “phone” and someone filled in “00 44 201 334987” the value pair would look like “phone=00 44 201 334987”.

The Method is how they are sent. The common methods are ‘Get’ and ‘Post’. If get is the method, the value pairs are displayed in the browser address bar, along with the url from the action and the receiving page ‘reads’ them from there. ($_GET)

What you need is a script to collect the value pairs and send them to you by email. It is quite likely that your web host provides one. If not you can get them free on the internet. Search for Matts Scripts. How to set them up is explained in the readme files and all in 1,00,001 tutorials all over the web.

Alternatively you could write your own using PHP and $_GET or $_POST.

Hope this helps.

  samwise101 17:44 26 Apr 2006

thank you so much for that...it really has helped...if my web host does provide me with th eability to send form results by e-mail, how will i know or where should i look


thanks again

  harristweed 18:29 26 Apr 2006

Have a look on their help pages or contact their support.

  chriswibbs 22:08 03 May 2006

don't know whether you've got this sorted or not, but this is what I use for any sites I design, and it does work.

In the form action bit, use Post, and set the target as sendmail.php.

Create a PHP doc, and put this in:

<?php

$to = "[email protected]" // Your email address
$subject = "New form submission" // subject of the form
$msg = "New form submission: \n\nName: $name \nOption 1: $option 1 \nOption 2: $option2 \n\n"


mail($to, $subject, $message)

?>

Where $name, $option1, and $option2 are the field names from your form, without the $. You can add more fields from your form into the code, just using the example I did.

Hope it helps.

  ade.h 18:57 04 May 2006

Re: spam. click here

  chriswibbs 19:23 04 May 2006

Yeah, most web hosts which have an online control panel offer scripts which can be installed just by clicking a button. And form mailers, are among the most common of these scripts.

This thread is now locked and can not be replied to.

Elsewhere on IDG sites

AMD Radeon Adrenalin release date, new features, compatible graphics cards

Indie publisher Canongate’s top 10 book covers of 2017

New iMac Pro release date, UK price & specs rumours

Tablettes Amazon Fire : quel modèle choisir ?