PHP Issues

kiwichris83

New Member
Joined
Feb 23, 2009
Messages
32
Reaction score
0
I'm a deafie whos trying 2 make a website for a business I'm developing to run from home.
AM having trouble with an PHP form for submitting orders to my email address.
I've got it set up where they select options and write in text boxes and upload an file, and then they click Submit, and it redirects them to a page that says thank you.
But I dont get the order in my email - I dont know where it goes!! in my PHP file, it has my email address so thought it was correct.
I did a testmail.php and that worked so I know the server is capable of doing this system.

here is the code I am using....can anyone help please? :ty:

<?php

//--------------------------Set these paramaters--------------------------


$subject = 'Form Submission'; // Subject of email sent to you.
$emailadd = 'chris_elizabeth@xtra.co.nz'; // Your email address. This is where the form information will be sent.
$url = 'www.oceansidegraphics.co.nz/thankyou.htm'; // Where to redirect after form is processed.
$req = '0'; // Makes all fields required. If set to '1' no field can not be empty. If set to '0' any or all fields can be empty.

// --------------------------Do not edit below this line--------------------------
$text = "Results from form:\n\n";
$space = ' ';
$line = '
';
foreach ($_POST as $key => $value)
{
if ($req == '1')
{
if ($value == '')
{echo "$key is empty";die;}
}
$j = strlen($key);
if ($j >= 20)
{echo "Name of form element $key cannot be longer than 20 characters";die;}
$j = 20 - $j;
for ($i = 1; $i <= $j; $i++)
{$space .= ' ';}
$value = str_replace('\n', "$line", $value);
$conc = "{$key}:$space{$value}$line";
$text .= $conc;
$space = ' ';
}
mail($emailadd, $subject, $text, 'From: '.$emailadd.'');
echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">';
?>
 
I don't see where it gets emailed to you.

Shouldn't there be a location where the emails should be sent to?
 
yea
in the bit where it says change these parameters
it has my email address which is chris_elizabeth at xtra.co.nz
am using that one just to get the form working as I'm getting some aliases made for the form specifically...

or am i doing the whole thing wrong lol
 
Looks like the php coding isn't closed. The email setting in the parameters seems correct. But the system won't compile. Try and get notepad++ from internet and paste htese php in notepad++ and ensure the notepad++ is formatted in php coding, where it will be possiblity help you find the error.


PHP:
<?php

//--------------------------Set these paramaters--------------------------


$subject = 'Form Submission'; // Subject of email sent to you.
$emailadd = 'chris_elizabeth@xtra.co.nz'; // Your email address. This is where the form information will be sent.
$url = 'www.oceansidegraphics.co.nz/thankyou.htm'; // Where to redirect after form is processed.
$req = '0'; // Makes all fields required. If set to '1' no field can not be empty. If set to '0' any or all fields can be empty.

// --------------------------Do not edit below this line--------------------------
$text = "Results from form:\n\n"; 
$space = ' ';
$line = '
';
foreach ($_POST as $key => $value)
{
if ($req == '1')
{
if ($value == '')
{echo "$key is empty";die;}
}
$j = strlen($key);
if ($j >= 20)
{echo "Name of form element $key cannot be longer than 20 characters";die;}
$j = 20 - $j;
for ($i = 1; $i <= $j; $i++)
{$space .= ' ';}
$value = str_replace('\n', "$line", $value);
$conc = "{$key}:$space{$value}$line";
$text .= $conc;
$space = ' ';
}
mail($emailadd, $subject, $text, 'From: '.$emailadd.'');
echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">';
?>
 
I'm kind of a newbie with PHP -
how do I identify the error?
have downloaded np++ and its open in there :)
 
Get a new page in the notepad++

(im new to PHP but I will see if I can help.)

select 'language' from the menu in notepad and select 'PHP"

then copy and paste there and you should find the errrors (depending on the colours)
 
The code in the parameters were wrong - (still unsure but may be possible) try and use the commas (") between these quotas, see edited code below (you can copy and pate if youw ant)

PHP:
$subject = "Form Submission"; // Subject of email sent to you. 
$emailadd = "chris_elizabeth@xtra.co.nz"; // Your email address. This is where the form information will be sent. 
$url = "www.oceansidegraphics.co.nz/thankyou.htm"; // Where to redirect after form is processed. 
$req = "0"; // Makes all fields required. If set to '1' no field can not be empty. If set to '0' any or all fields can be empty.
 
everythings in
blue or grey and theres actually 2 shades of blue...

the only things in red is the <?php and ?> as well as the numbers 20 and 1
and this is in the area not to edit..

Oddly though - I downloaded this script as I dont know how to make it so would be suprised if theres a error there...

In the Parameters for me to edit - everything on the left side is blue, the bits where "form submission" my email address and website addy etc is grey, and the words on the right is all green....

hope that explains anything...I could do an screenshot and email to you or something...

I've searched up and down google and havent got very far, am wanting to use this one coz its easy and not much to change....but as if its easy lol
 
Blue shades directs you to an error, I think... send the screenshot if you can.
 
I think in the do not edit line has a little error but I will just investiage with my dreamweaver software. This sounds a bit stupud but where did you get the code from?
 
Kiwi - you know that for this kind of Form, you usually need 3 pages.

1. the Form page where the user types in info
2. the PROCESS page where it processes your form
3. the Thank You page

I'm assuming that you have done all 3 and it's still not working. It's most likely because it went to your spam folder and/or your server's rejecting it.
 
That code I retrieved from the site you provided is an EPIC FAIL!

They sent the people broken code.
 
I tested with my own email address, it failed too, Jiro.
 
ohhh no wonder mines not working - and proves how much of a newbie i am :shock: lol...

so do u think i should look 4 a different form or do u know how 2 fix it?

the page I'm trying to have submitted was made in Frontpage - has a few check boxes, 2 uploading images functions, a few text boxes and a radio button, and the php file has to be able to send the entire form including images to my email addy...
 
ohhh no wonder mines not working - and proves how much of a newbie i am :shock: lol...

so do u think i should look 4 a different form or do u know how 2 fix it?

the page I'm trying to have submitted was made in Frontpage - has a few check boxes, 2 uploading images functions, a few text boxes and a radio button, and the php file has to be able to send the entire form including images to my email addy...

yes the most likely culprit is that it's not properly passing the data to process.php (the codes you just pasted). Please paste the code for the form (#1). I just read your code and your process script is correct. Your form file is probably not coded right.
 
i'm only using frontpage for the form page as its "built" in frontpage but using a different software for the actual website...

i'll upload the corrected form and see if that works...
 
FrontPage 2002 - is sooo high school.

lol it's fine. I just don't use either Dreamweaver or Frontpage's WYSIWYG editor. As long as you're in CODER view, whatever the program you're using is fine. The reason why I use those is because of its nifty code coloring and auto-format.

beside that.... notepad++ is just fine as well.
 
Back
Top