Jump to content

Help needed for email form script with GoDaddy


Tangentina

Recommended Posts

Hi everyone,

I have two email forms I designed with CSS and HTML which I want to use on two of the domains I have on my shared hosting account with GoDaddy.

 

I have tried a few sample scripts with the accompanying html files but with this shared hosting the form won’t work with the php file in the same directory as the html form. It has to work from the root directory.

 

Go Daddy cannot give me custom scripting advice for the obvious reasons but have informed me that some customers have managed to get their php files working for their different domains by looking at the script that GoDaddy supply in the root directory and working it out.

 

I am able to configure my html form to work with the basic php mailform scripts I can get free online but do not know php and wouldn’t have a clue how to customise it so that it works on that page from my root directory. I imagine that I may need two separate scripts for the two domains I want the forms to work on.

 

The php script that GoDaddy supply which apparently only works with the main domain (for which I do not need an email form) is as follows:

 

<?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"]."/");

    }

 

 

 

?>

 

 

Can anyone help me with this please?

 

Link to comment
Share on other sites

There is most likely a simple solution as to why your script isn't working.  Post it up, and we could help out, as there is no reason a script has to reside in the root directory to work.  GoDaddy is horrible (IMHO), but even they wouldn't do that.

Link to comment
Share on other sites

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.