Jump to content

Archived

This topic is now archived and is closed to further replies.

Relevancy

*SOLVED* Send data php4 to php5

Recommended Posts

Ok I have several sites using this send data script, but a new site got put on a server that has php5 and now the script is not working. It sends blank emails and doesnt not include the field data from the form.

Here is the page with the form [a href=\"http://www.beyondfossilfuel.com/promote.html\" target=\"_blank\"]http://www.beyondfossilfuel.com/promote.html[/a]

Here is the php code for the send data script:

[code]<?php

$contents = $HTTP_SERVER_VARS['REMOTE_ADDR'] . " just entered this data into the form: " . $HTTP_POST_VARS['pageName'] . "\n\n";

//get the contents of the form from a post
while(list($key, $value) = each($HTTP_POST_VARS))
{
    
    if($key == "sendto"){
        $sendto = $value;
    }
    elseif($key == "redirectpage"){
        $redirectpage = $value;
    }
    elseif($key == "subject"){
        $subject = $value;
    }
    else
    {
        $contents .= "$key \t = \t $value \n";
    }
}

//get the contents of a form from a get
while(list($key, $value) = each($HTTP_GET_VARS))
{
    if($key == "sendto"){
        $sendto = $value;
    }
    elseif($key == "redirectpage"){
        $redirectpage = $value;
    }
    elseif($key == "subject"){
        $subject = $value;
    }
    else
    {
        $contents .= "$key \t = \t $value \n";
    }
    
}

//attach footer message

$from_header = "From: Beyond Fossil Fuel";

if($contents != "")
{
   //send mail - $subject & $contents come from surfer input
   mail($sendto, $subject, $contents, $from_header);
   // redirect back to url visitor came from
   header("Location: $redirectpage");
}
  else
{
   print($contents);    
   print("<HTML><BODY>Error, no data was submitted!");
   print("</BODY></HTML>");
}

?>[/code]

What do I need to change? I am not a php programmer at all. help!

Share this post


Link to post
Share on other sites
I believe your new site that has PHP5 has a setting called [b]register_long_arrays[/b] turned off in the php.ini and so your [b]$HTTP_*_VAR[/b]'s are not being populated/recognised. In order for your script to work correctly take of the HTTP and _VAR bits in your variable names like so:
$HTTP_POST_VAR become $_POST
$HTTP_GET_VAR becomes $_GET
$HTTP_SERVER_VAR becomes $_SERVER

You should use the much new superglobal arrays instead, which $_POST, $_GET, $_COOKIE, $_SESSION, $_SERVER etc.

Share this post


Link to post
Share on other sites

×

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.