Jump to content

Recommended Posts

I am on a GoDaddy hosted site trying to process a form.

 

First off, the gdform.php:

<?php
    $request_method = $_SERVER["REQUEST_METHOD"];
    if($request_method == "GET"){
      $query_vars = $_GET;
    } elseif ($request_method == "POST"){
      $query_vars = $_POST;
    }
    reset($query_vars);
    $t = date("U");

    $file = $_SERVER['DOCUMENT_ROOT'] . "/../data/gdform_" . $t;
    $fp = fopen($file,"w");
    while (list ($key, $val) = each ($query_vars)) {
     fputs($fp,"<GDFORM_VARIABLE NAME=$key START>\n");
     fputs($fp,"$val\n");
     fputs($fp,"<GDFORM_VARIABLE NAME=$key END>\n");
     if ($key == "redirect") { $landing_page = $val;}
    }
    fclose($fp);
    if ($landing_page != ""){
header("Location: http://".$_SERVER["HTTP_HOST"]."/$landing_page");
    } else {
header("Location: http://".$_SERVER["HTTP_HOST"]."/");
    }
?>

Looks to me like a recursive function that spits out all data in no particular order.

 

My variables:

"Name" - Type: Text

"City" - Type: Text

"Email" - Type: Text

etc...

Instrumentalist - Type: Checkbox - Returns "on" if checked

Vocalist - Type: Checkbox - Returns "on" if checked

etc...

 

What I want is to be able to receive an email that says:

 

Hello, you have received a response from your web form!

 

Bob Smith of Jonesville is a

- Vocalist

- Instrumentalist

- Harmonist

 

...

 

I assume that this will be accomplished through if and echo statements like:

 

echo $Name; echo " of "; echo $City; echo " is a<br>"
if $vocalist == "on" then echo " - Vocalist<br>"

...

 

Am I on the right track?  All attempts thus far have failed.  Once I get down the right path, I'm sure that I can find the rest of the way.  Thanks so much, experts!

 

 

 

You will need to modify it to handle more variables, but here's a start.

 

Hope this helps you out.

<?php
$request_method = $_SERVER['REQUEST_METHOD'];
$is_a = "";
if ($request_method == "GET"){
$vars = $_GET;
}
elseif ($request_method == "POST"){
$vars = $_POST;
}
function cleanInput($vars){
foreach ($vars as $key->$val){
	$out[$key] = htmlspecialchars($val);
}
}
$vars = cleanInput($vars);
$name = $vars['Name'];
$city = $vars['City'];
$Email = $vars['Email'];
if ($vars['Vocalist'] == "on"){
$is_a .= "\t-Vocalist\r\n";
}
if ($vars['Instrumentalist'] == "on"){
$is_a .= "\t-Instrumentalist\r\n";
}
$msg_body = "Hello, you have received a response from your web form!\r\n\r\n$name of $city is a\r\n$is_a\r\n\r\nTheir E-mail Address is $Email\r\n";
$your_email = "Sydcomebak@somedomain.com";
$your_name = "Sydcomebak";
$headers = "To: $your_name <$your_email>\r\n";
$headers = "From: Form Submission Alert <$your_email>\r\n";
mail($your_email,"Someone posted to your web form",$msg_body,$headers);
?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.