PDA

View Full Version : how do I retreive info from Form field boxes?


keano
10-19-2005, 06:35 PM
Ex. http://www.reliaquote.com/?sourceid=00A00000032000000000 ('http://www.reliaquote.com/?sourceid=00A00000032000000000')

I know how to create the boxes where the input text goes and choices. But I don't now how to retrieve the information so it's sent back to me?

Can someone help please?

davidj
10-20-2005, 08:51 AM
are you wanting to build a contacts form?? where you are emailed with the contents?

if this is the case then you need a handling script

php,asp,cgi etc,etc (etc is not one! :D)

do you have any experience with these??

ramandeep
10-21-2005, 09:35 AM
Hi ,
Make your form ,in form properties give action=script.php

and copy the following code on script.php

(please also set the parameters like $subject,$emailid,$url etc below)
<?php

//--------------------------Set these paramaters--------------------------


$subject = 'Form Results'; // Subject of email sent to you.
$emailadd = 'ramandeep@rdsnetworks.net'; // Your email address. This is where the form information will be sent.
$url = 'http://www.rdsnetworks.net'; // Where to redirect after form is processed.
$req = '1'; // Makes all fields required. If set to '1' no field can not be empty. If set to '0' any or all fields can be empty.

// --------------------------Do not edit below this line--------------------------
$text = "Results from form:\n\n";
$space = ' ';
$line = '
';
foreach ($_POST as $key => $value)
{
if ($req == '1')
{
if ($value == '')
{echo "$key is empty";die;}
}
$j = strlen($key);
if ($j >= 20)
{echo "Name of form element $key cannot be longer than 20 characters";die;}
$j = 20 - $j;
for ($i = 1; $i <= $j; $i++)
{$space .= ' ';}
$value = str_replace('\n', "$line", $value);
$conc = "{$key}:$space{$value}$line";
$text .= $conc;
$space = ' ';
}
mail($emailadd, $subject, $text, 'From: '.$emailadd.'');
echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">';
?>


You can use this script with any form and just change the parameters.
It will send the form results to your email address.
Cheers!

davidj
10-21-2005, 09:49 AM
You can use this script with any form and just change the parameters.
It will send the form results to your email address.
Cheers!

thats great ramandeep :D

as long as keano is using PHP but by the way keano has written his post i dont think he is