Help needed please

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
Kerrysmagicshirt
Forum Newbie
Posts: 3
Joined: Sat Mar 04, 2006 1:28 pm
Location: Wolverhampton UK

Help needed please

Post by Kerrysmagicshirt »

feyd | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]


hi there all you fantastic PHP enthusiasts.    

i have a serious problem getting a php email form to work - however a freind of mine wrote the code and has left me to it.  I unfortunatly no nothing about PHP and cannot figure out how to get the thing to work.

I'm sure you get real frustrated by noobie know nothings asking you to help out and do thier work for them - but i am going to work through the tutorials i found on here and really do want to learn what i am doing - in the mean time getting this form to work is a bit of an emergency and i would appreciate any help you can offer.

The form can be found at  [url]http://www.toxiccreations.co.uk/contact_band_design_general.html[/url]
You'll notice there is another form too for quotes i'm hoping that by figuring one out i'll figure the other out so please ignor that for now.

te form has been created in Flash8
The actionscript i have on the send button is

Code: Select all

on (release) {
	gotoAndPlay(2);
	loadVariablesNum("http://www.toxiccreations.co.uk/GeneralForm.php", 0, "POST");
}
frame 2 contains a thank you page.
the PHP code i have is:

Code: Select all

<?php

  $name = $_POST['name'] ;
  $email = $_POST['email'] ;
  $message = $_POST['questions'] ;

  if (!isset($_POST['email'])) {
    header( "Location: http://www.toxiccreations.co.uk/general_form.swf" );
  }
  elseif (empty($name) || empty($email) || empty($message)) {
    header( "Location: http://www.toxiccreations.co.uk/errorform.html" );
  }
  else {
    mail( "info@toxiccreations.co.uk", "General",
      $message, "From: $name <$email>" );
      }
?>
can you spot any errors that may be causeing it to fail? i have tried to get it to send without filling in all fields to see if it directs to the error form - but this does not work either.

Please excuse my lack of PHP knowledge but your help will be massivly appreciated.
All the best x


feyd | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
User avatar
neophyte
DevNet Resident
Posts: 1537
Joined: Tue Jan 20, 2004 4:58 pm
Location: Minnesota

Post by neophyte »

These problems can be difficult to debug. Here's what I suggest:

Build a regular html form to submit to your php page. On your php page put:

Code: Select all

var_dump($_POST);
Now you'll be able to see if variables are coming through correctly.

Does the php page work by itself or does it need to be tweaked?

I've built one of these before but I can't remember for the life of me what Action Script method I used. I think it was sendAndLoad(). I wanted the .swf to know if mail had been sent. In this way I was even able to validate email addresses. So. That's a place to start.

If it's not working there you need to go back to flash and make sure your variables are named correctly.

Have fun!
Kerrysmagicshirt
Forum Newbie
Posts: 3
Joined: Sat Mar 04, 2006 1:28 pm
Location: Wolverhampton UK

Post by Kerrysmagicshirt »

i have definatly checked the variable names and they all match up.

i wouldn't know for the life of me how to create the form again in html, and i really wouldn't know if the php is right or not - i have absolutly no knowlege of it al all.

:oops:
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

you're not getting the error form because code is still being executed after the header call
to redirect change your header lines to this

Code: Select all

header("Location: whatever");
die(); // add the die in here so the code stops executing
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
Kerrysmagicshirt
Forum Newbie
Posts: 3
Joined: Sat Mar 04, 2006 1:28 pm
Location: Wolverhampton UK

Post by Kerrysmagicshirt »

ohh thanks for that.

any idea why it won't post al all?

sorry feyd - now i know i will :)
Post Reply