MailForm variable problem?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
brian914
Forum Newbie
Posts: 4
Joined: Tue Nov 21, 2006 9:52 am

MailForm variable problem?

Post by brian914 »

I am using this mail script with a from on my page. I don't really speak php, but had this working great, several times in the past. Now I am getting these weird error notices from this mail form script I have been using. I have never had any issues with this script before and have used it on quite a few different servers. I had this on another sever before and it was working, but after it got moved, it has been giving me these error messages, that I don't know what to do with. Could it be that the server is running a version of php that is too old? Wrong platform?

Here is what I get if I submit this from.

Notice: Undefined index: mail_newline in D:\hshome\c21bestv\c21nicabeachfront.com\formmail2.php on line 374

Notice: Undefined index: alias_method in D:\hshome\c21bestv\c21nicabeachfront.com\formmail2.php on line 403

Notice: Undefined index: alias_method in D:\hshome\c21bestv\c21nicabeachfront.com\formmail2.php on line 403

etc...

Then further down:
Warning: Cannot modify header information - headers already sent by (output started at D:\hshome\c21bestv\c21sanjuan.com\formmail2.php:374) in D:\hshome\c21bestv\c21sanjuan.com\formmail2.php on line 571
[PHPFormMail] Normal e-mail sent from IP 69.105.225.52


Also, when I get the e-mail from the server, it looks something like this:
: Brian

:
:
:
: brian@agilitygraphics.com
:
:
:
: ---
: ---
:
: Submit Form

So it is not showing the variables. It should and used to look like this:

first_name: Brian
last_name: Forstat
etc.


The actual form is here:
http://www.c21nicabeachfront.com/stage/ ... quest.html

Any ideas what could be causing this and how to fix it. I googled the issue and there are some articles, but I don't understand them, since my php knowledge is pretty minimal.
Any help would be greatly appreciated.
Thanks a lot!
B
User avatar
GeertDD
Forum Contributor
Posts: 274
Joined: Sun Oct 22, 2006 1:47 am
Location: Belgium

Re: MailForm variable problem?

Post by GeertDD »

brian914 wrote:Could it be that the server is running a version of php that is too old? Wrong platform?
The server probably has another default value set for the error reporting. The quick and dirty "fix" is to hide these notices again.

Code: Select all

// Report all errors except E_NOTICE
error_reporting(E_ALL ^ E_NOTICE);
However, a more solid solution would be to initialize all the variables of the script.
brian914
Forum Newbie
Posts: 4
Joined: Tue Nov 21, 2006 9:52 am

Post by brian914 »

How would I initialize all the variables?

Thanks a lot for the help!
User avatar
GeertDD
Forum Contributor
Posts: 274
Joined: Sun Oct 22, 2006 1:47 am
Location: Belgium

Post by GeertDD »

brian914
Forum Newbie
Posts: 4
Joined: Tue Nov 21, 2006 9:52 am

Post by brian914 »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


I think I am probably doing it wrong. Like I said, I don't speak much php. I just read through the tutorial you posted. I pasted the following at the top of my php document, but it did not take care of the issue. What that wrong?

Code: Select all

/*  initvar()
 *  Initialize variables
 *  © Amit Arora <digitalamit dot com>
 *  Permission give to use this code for Non-Commericial, Commericial use
 *  It would be appreciated if you could provide a link to the site
 */
function initvar()
{
    foreach( func_get_args() as $v )
    {
        if( is_array( $v ) )
        {
            while( list( $key, $value ) = each( $v ) )
            {
                $GLOBALS[$key] = ( !isset($GLOBALS[$key]) ? $value : $GLOBALS[$key] );
            }
        }
        else
        {
            $GLOBALS[$v] = ( !isset($GLOBALS[$v]) ? '' : $GLOBALS[$v] );
        }
    }
}

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Post Reply