View Full Version : GoDaddy gdform.php problem

10-19-2007, 03:54 PM

Ive read some other threads on the gdform.php but none of them were really able to help me out, so Im hoping someone can! :)

Now, Im not very familiar with php, however I would like to create a form on the site where people can fill it out and it gets sent to my e mail- simple enough I thought, since godaddy provides instructions for their gdform!

Well, I saved my gdform.php in the same folder as my form html which is as follows:

<style type="text/css">
.style1 {font-family: Verdana, Arial, Helvetica, sans-serif}

body {
background-color: #E6DEEB;
.style2 {font-size: 12px}
.style3 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; }
<body scroll="yes">
<form action="gdform.php" method="post" enctype="text/plain">
<input type="hidden" name="subject" value="Form Submission" />
<input type="hidden" name="redirect" value="http://www.trinityinvestmentgroup.net/sell/sell/thankyou.html" />
<p><span class="style3">First Name</span><span class="style2">:</span>
<input type="text" name="FirstName" /></p>
<p><span class="style3">Last Name:</span>
<input type="text" name="LastName" /></p>
<p><span class="style3">E-Mail:</span>
<input type="text" name="email" /></p>
<p><span class="style3">Phone:</span>
<input type="text" name="phone" /></p>
<p><span class="style3">Sales Price:</span>
<input type="text" name="sales price" size="20" maxlength="20"></p>
<p><span class="style3">Lot Address:</span>
<input type="text" name="lot address" size="55" /></p>
<p><span class="style3">Lot Dimension:</span>
<input type="text" name="lot dimension" /></p>
<p><span class="style3">Land Description</span><span class="style2">:</span>
<textarea name="land description" cols="40" rows="10"></textarea>
<p><span class="style1 style2">Comments</span><span class="style2">:</span>
<textarea name="comments" cols="40" rows="10">
<input type="submit" name="submit" value="submit"/>
Then, my gdform that godaddy has provided looks like this:

$request_method = $_SERVER["REQUEST_METHOD"];
if($request_method == "GET"){
$query_vars = $_GET;
} elseif ($request_method == "POST"){
$query_vars = $_POST;
$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,"<GDFORM_VARIABLE NAME=$key END>\n");
if ($key == "redirect") { $landing_page = $val;}
if ($landing_page != ""){
header("Location: http://".$_SERVER["HTTP_HOST"]."/$landing_page");
} else {
header("Location: http://".$_SERVER["HTTP_HOST"]."/");


Now, Im having two issues- my thankyou.html redirect page is not coming up- but my index page when I hit Submit.
AND when I submit something- its not in my inbox. Or in my spam folder. Its like its not working. Does anyone have any ideas? And please as layman as possible! lol.. thanks!

10-20-2007, 06:28 AM
Ugh. GoDaddy stuff.

Use the mail() (http://www.php.net/manual/en/ref.mail.php) function. Much easier.

10-22-2007, 04:05 PM
Thank you for the suggestion, but as I stated before I am no php or coding expert period, so I wouldnt even know how to begin with the mail function... I clicked on the link in your reply for the mail function and... well... I just dont get it lol. Im sorry :(

10-22-2007, 06:24 PM
Well, this stuff isn't exactly easy, but you can work it out.
Using godaddy's setup will likely be harder, perhaps not in it's concept, but in the end because it will be buggy. I use godaddy but haven't bothered trying their scripts; I just write my own.

$landing_page is the page it will be sent to, IF that variable is defined. Otherwise, it directs to the main page on the site as you have not specified a page.
Use this to set the page, anywhere near the top of the php script:
$landing_page = 'mypage.php'; //your.com/mypage.php

Now, as for it not sending the mail, I have no idea.

That script is not meant to send mail. It writes the data to a file, with fopen() fputs(), etc. Then, I would guess, the server automatically sends the contents of such a file to your email address, if this has been properly setup.

From what I can see, the PHP looks accurate enough and the file is likely being generated. You could echo the contents of the file to check, but as it likely is working, I'd suggest going into cpanel and checking out what the settings are-- is it set to the right email? etc.

However, using mail() is quite basic:
mail($to,$subject,$body); //sent
Just be sure to have all of that info right and you're done.

Note: I have had some weird/fatal problems using mail() on godaddy's windows servers, if you happen to not be on linux (on linux, it works fine).

Please use [code] tags around code when you post it. Much easier to read. I just added them to your post, by the way.

11-02-2007, 08:37 PM
I had the same problem and wound up finding this forum from a search engine, so hello everyone. I gather from the phpinfo() page, that GoDaddy has the mail() function disabled on its NT servers(the sendmail_from category has no local or master value). So your only option is to conform to their standards.

Also, more good news, apparently the file is written and is then sent to the MX on an hourly que. So if you finally do figure out exactly how GoDaddy wants the form to work and want to test it, you may have to wait an hour to see if it worked.

While the form may have been designed to make things simpler, some of us are learning exactly why they call it a GD form.

Here is how GoDaddy wants the form set up:

I also found a site that claims that mail is not the only function disabled on GoDaddy machines. Here is a list provided by http://www.imscart.com :

Godaddy PHP Disabled Functions (Linux): All Posix functions disabled. Also, the following functions are disabled: fpassthru, file, mail, exec, system, passthru, popen, crack_check, crack_closedict, crack_getlastmessage, crack_opendict, fsockopen, psockopen, opendir, readdir, closedir, phpinfo

It has also been noted that they do not list ALL of the functions that they have disabled. For example move_uploaded_file() sometimes is disabled too.

11-02-2007, 09:36 PM
Windows servers with godaddy are weird. Then again, PHP on windows can just be weird sometimes anyway.

That list is a bit off, though, at least. Clearly phpinfo is not disabled...

05-23-2009, 01:06 PM
Hey guys, did you find out what is the solution for sending mail with godaddy??

I am facing the same problem, i have a shared windows hosting, this it my code in the contact.html:

<form action="/gdform.php" method="post" enctype="text/plain"><input type="hidden" name="subject" value="Form Submission" /> <input type="hidden" name="redirect" value="http://www.hrvojemesec.com/hvala.html" /><input type="text" name="FirstName" size="30" id="aaa"/><input type="text" name="email" size="30" id="bbb"/><textarea rows="20" cols="24" name="comments" id="ccc"></textarea><input type="submit" value="Šalji" id="ddd" /></form>

and this is godaddy's gdform.php file for sending form mail:

$landing_page = 'hvala.html';
$request_method = $_SERVER["REQUEST_METHOD"];
if($request_method == "GET")
$query_vars = $_GET;
elseif ($request_method == "POST")
$query_vars = $_POST;

$t = date("U");
$file = $_SERVER['DOCUMENT_ROOT'] . "\ssfm\gdform_" . $t;
$fp = fopen($file,"w");

while (list ($key, $val) = each ($query_vars))
fputs($fp,"<GDFORM_VARIABLE NAME=$key START>\r\n");
fputs($fp,"<GDFORM_VARIABLE NAME=$key END>\r\n");
if ($key == "redirect")
$landing_page = $val;


if ($landing_page != "")
header("Location: http://".$_SERVER["HTTP_HOST"]."/$landing_page");
header("Location: http://".$_SERVER["HTTP_HOST"]."/");

I set it all up and when i send an email it gets in my inbox but it is blank!!! Help anyone!!