Jump to content

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!
Link to comment
https://forums.phpfreaks.com/topic/10283-solved-send-data-php4-to-php5/
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.
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.