Rossp2000 Posted August 2, 2012 Share Posted August 2, 2012 Thank you in advance if you can help. Godaddy is leaving me hanging on this. I switched my deluxe hosting from Win to Lin to learn wordpress. In doing this, my active subdomain sites no longer have their form mail working. I switched from an gdform.asp to their gdform.php and have the forms working (I get the emails) however it defaults back to the root index page after form is submitted. I need them all to go to at least 1 page in one of my subdomain sites. Godaddy is completely unwilling to help with a seemingly easy request & I know nada about php programming. In the meantime, I have 3 small business sites that are kind of dead in the water. Would someone here be able and willing to lend me a hand with this? It would REALLY be appreciated. Their provided form is gdform.php: (it reads like Latin to me) :'( Can I modify this file or do I need a new php script? <?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"]."/"); } ?> 18775_.php Quote Link to comment Share on other sites More sharing options...
Drummin Posted August 2, 2012 Share Posted August 2, 2012 I am no expert in this area, so I apologize if this doesn't work. I assume the idea is to get the name of the subdomain and rebuild the path. This is what I came up with. <?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); //find subdomain and rebuild path $subdomain = strpos($_SERVER['HTTP_HOST'], "."); $subdomain = substr($_SERVER['HTTP_HOST'], 0, $subdomain); $path = "$subdomain/{$_SERVER['HTTP_HOST']}"; if ($landing_page != ""){ header("Location: http://$path/$landing_page"); exit; } else { header("Location: http://$path/"); exit; } ?> EDIT: My sample didn't work when I just tested it. Sorry about that. $_SERVER['HTTP_HOST'] is showing the subdomain path already so I'm not sure what the issue is with your code. I would probably use relative paths anyway. Quote Link to comment Share on other sites More sharing options...
Rossp2000 Posted August 6, 2012 Author Share Posted August 6, 2012 In your opinion, is there any chance of this fixing my problem? There is a post titled here: Simple php form question - How to redirect to page after submit? ? on: June 06, 2011, 02:58:03 pm ? The code looks like: <? $subject="from ".$_GET['name']; $headers= "From: ".$_GET['email']; $headers.=$_GET['phone']. "\n"; $headers.='Content-type: text/html; charset=iso-8859-1'; mail("myname@company.com", $subject, " " ."Name: " .$_GET['name']." " ."Phone: " .$_GET['phone']." " ."Email: " .$_GET['email']." " ."Message: " .$_GET['message']." </body> </html>" , $headers); header("location: http://www.company.com/index.html"); ?> Could I used this solution in place of my existing gdform.php? Any help would REALLY be appreciated. GoDaddy is zero help to me and my sites are down (at least the forms are) Thanks. Quote Link to comment Share on other sites More sharing options...
Rossp2000 Posted August 6, 2012 Author Share Posted August 6, 2012 to answer my own question...No...It looks like a basic form. Hummm...I wish GoDaddy wouldn't force me to be a php programmer!! grrrr..... Quote Link to comment Share on other sites More sharing options...
Jessica Posted August 6, 2012 Share Posted August 6, 2012 You're the one who switched your service. If you want to "learn Wordpress" whatever that means, do it on your own computer so it doesn't affect the "business" sites. Problem solved. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.