Jump to content

php5 and contact form


julieb

Recommended Posts

At first glance no changes are needed. Doesn't it work as expected?

 

 

Nope... my hosting company says they have php5 and the php file is for php4....I read online somewhere that the code should not read $ it should read post something... but I dont know anything about the codes..

 

thank you for responding:)

Link to comment
Share on other sites

In your browser's window when you execute the script...

 

Strange...

 

Let's try another thing:

add this

 

echo "message: $message";
echo "<br/>";
echo "headers: $headers";

 

Just above

mail($sendTo, $subject, $message, $headers);

 

This way we'll see if message and headers are set up properly

Link to comment
Share on other sites

How are running the script? I understand its a template but how is this script invoked?

 

There is nothing wrong with the script you have attached. PHP5 is backwards compatible with PHP4 code.

 

That script will not output anything as its not being told to output anything. All it does is send an email.

Link to comment
Share on other sites

I saw the error message on my server.  This is what it said

 

[15-Sep-2008 18:04:01] PHP Notice:  Undefined index:  firstName in /home/webdesi/public_html/rentacoder/rd/email.php on line 32

[15-Sep-2008 18:04:01] PHP Notice:  Undefined index:  lastname in /home/webdesi/public_html/rentacoder/rd/email.php on line 32

[15-Sep-2008 18:04:01] PHP Notice:  Undefined index:  firstName in /home/webdesi/public_html/rentacoder/rd/email.php on line 32

[15-Sep-2008 18:04:01] PHP Notice:  Undefined index:  lastname in /home/webdesi/public_html/rentacoder/rd/email.php on line 32

 

 

I am assuming line 32 is incorrect??

 

 

Any suggestions... thank you so much!

Link to comment
Share on other sites

Ok. So you're using it together with a Flash (which makes it a little bit more complicated for me)

 

Anyway, the mail.php expects to be fed with

firstName

lastname

email

message

 

While your contact form has these fields

Name

Company

E-Mail

Phone

Message

 

They aren't exactly the same, are they?

 

Now, it's almost sure, that your form is not sending the required information to mail.php script (or the other way round - mail.php is not prepared for working with this form). How to fix it, I've no idea, because I have no experience with Flash forms.

 

Maybe...

 

Maybe if you added

 

trigger_error(print_r($_POST), E_USER_NOTICE);

somewhere in your mail.php, we could see what data is actually being sent from the form. The message would appear in error logs, just where you've found information about 'undefined indexes'

 

Link to comment
Share on other sites

Are you wanting something to happen when the user submits the form in your contact page (other than send the email ofcourse)? Such as a confirmation message or something. If so you'll need to add more code to your flash app for this to happen.

 

Also as you're using mail() you'll need to make sure PHP is configured to use an SMTP server in order for any emails to be sent. You should check with your host about this.

Link to comment
Share on other sites

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.