AllDeaf.com
Our Sponsors

Go Back   AllDeaf.com > Technology > Web, Graphic Design & Site Building
  
Reply
 
LinkBack Thread Tools Display Modes
Old 03-29-2009, 09:00 PM   #1 (permalink)
Registered User
 
Join Date: Feb 2009
Location: Ohope Beach - New Zealand
Posts: 32
PHP Issues

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?

<?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.'">';
?>
kiwichris83 is offline   Reply With Quote
Alt Today
Deafness

Beitrag Sponsored Links

__________________
This advertising will not be shown in this way to registered members.
Register your free account today and become a member on AllDeaf.com
   
Old 03-29-2009, 10:41 PM   #2 (permalink)
bloody phreak from hell
 
VamPyroX's Avatar
 
Join Date: Feb 2003
Location: Hell
Posts: 31,457
Send a message via ICQ to VamPyroX Send a message via AIM to VamPyroX Send a message via Yahoo to VamPyroX
I don't see where it gets emailed to you.

Shouldn't there be a location where the emails should be sent to?
__________________

Check out my city... CLICK HERE!
(If you already visited yesterday, visit again today!)
VamPyroX is offline   Reply With Quote
Old 03-29-2009, 11:41 PM   #3 (permalink)
Registered User
 
Join Date: Feb 2009
Location: Ohope Beach - New Zealand
Posts: 32
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
kiwichris83 is offline   Reply With Quote
Old 03-29-2009, 11:53 PM   #4 (permalink)
Good times, good times.
 
JClarke's Avatar
 
Join Date: Nov 2006
Location: Packing bags for U.S.A
Posts: 20,207
Blog Entries: 5
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 Code:
<?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.'">';
?>
__________________
JClarke is offline   Reply With Quote
Old 03-30-2009, 12:07 AM   #5 (permalink)
Registered User
 
Join Date: Feb 2009
Location: Ohope Beach - New Zealand
Posts: 32
I'm kind of a newbie with PHP -
how do I identify the error?
have downloaded np++ and its open in there
kiwichris83 is offline   Reply With Quote
Old 03-30-2009, 12:16 AM   #6 (permalink)
Good times, good times.
 
JClarke's Avatar
 
Join Date: Nov 2006
Location: Packing bags for U.S.A
Posts: 20,207
Blog Entries: 5
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)
__________________
JClarke is offline   Reply With Quote
Old 03-30-2009, 12:21 AM   #7 (permalink)
Good times, good times.
 
JClarke's Avatar
 
Join Date: Nov 2006
Location: Packing bags for U.S.A
Posts: 20,207
Blog Entries: 5
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 Code:
$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. 
__________________
JClarke is offline   Reply With Quote
Old 03-30-2009, 12:23 AM   #8 (permalink)
Registered User
 
Join Date: Feb 2009
Location: Ohope Beach - New Zealand
Posts: 32
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
kiwichris83 is offline   Reply With Quote
Old 03-30-2009, 12:26 AM   #9 (permalink)
Good times, good times.
 
JClarke's Avatar
 
Join Date: Nov 2006
Location: Packing bags for U.S.A
Posts: 20,207
Blog Entries: 5
Blue shades directs you to an error, I think... send the screenshot if you can.
__________________
JClarke is offline   Reply With Quote
Old 03-30-2009, 12:34 AM   #10 (permalink)
Registered User
 
Join Date: Feb 2009
Location: Ohope Beach - New Zealand
Posts: 32
the only things missing off the page is
the php?> and ?>

heres the screenshot
Attached Images
File Type: jpg phpscreenshot.jpg (85.0 KB, 8 views)
kiwichris83 is offline   Reply With Quote
Old 03-30-2009, 12:42 AM   #11 (permalink)
Good times, good times.
 
JClarke's Avatar
 
Join Date: Nov 2006
Location: Packing bags for U.S.A
Posts: 20,207
Blog Entries: 5
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?
__________________
JClarke is offline   Reply With Quote
Old 03-30-2009, 12:48 AM   #12 (permalink)
Registered User
 
Join Date: Feb 2009
Location: Ohope Beach - New Zealand
Posts: 32
FrontPage 2002 - Create a user submit form for your site.

I just found this Form Mail simplescript.php [Archive] - PowWeb Community Forums
but cant figure out what the solution meant....as it sounds like he had the same problem as me - email not sending.
kiwichris83 is offline   Reply With Quote
Old 03-30-2009, 12:55 AM   #13 (permalink)
YOU DOMESTIC DISSENT!
 
Jiro's Avatar
 
Join Date: Apr 2007
Location: The Sopranos State
Posts: 22,913
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.
__________________
- Don't forget to buy Jiro's Special Edition Sunglasses for $19.95
Jiro is offline   Reply With Quote
Old 03-30-2009, 12:56 AM   #14 (permalink)
Good times, good times.
 
JClarke's Avatar
 
Join Date: Nov 2006
Location: Packing bags for U.S.A
Posts: 20,207
Blog Entries: 5
That code I retrieved from the site you provided is an EPIC FAIL!

They sent the people broken code.
__________________
JClarke is offline   Reply With Quote
Old 03-30-2009, 12:58 AM   #15 (permalink)
Good times, good times.
 
JClarke's Avatar
 
Join Date: Nov 2006
Location: Packing bags for U.S.A
Posts: 20,207
Blog Entries: 5
I tested with my own email address, it failed too, Jiro.
__________________
JClarke is offline   Reply With Quote
Old 03-30-2009, 12:59 AM   #16 (permalink)
Registered User
 
Join Date: Feb 2009
Location: Ohope Beach - New Zealand
Posts: 32
ohhh no wonder mines not working - and proves how much of a newbie i am 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...
kiwichris83 is offline   Reply With Quote
Old 03-30-2009, 01:00 AM   #17 (permalink)
Good times, good times.
 
JClarke's Avatar
 
Join Date: Nov 2006
Location: Packing bags for U.S.A
Posts: 20,207
Blog Entries: 5
FrontPage 2002 - is sooo high school.
__________________
JClarke is offline   Reply With Quote
Old 03-30-2009, 01:02 AM   #18 (permalink)
YOU DOMESTIC DISSENT!
 
Jiro's Avatar
 
Join Date: Apr 2007
Location: The Sopranos State
Posts: 22,913
Quote:
Originally Posted by kiwichris83 View Post
ohhh no wonder mines not working - and proves how much of a newbie i am 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.
__________________
- Don't forget to buy Jiro's Special Edition Sunglasses for $19.95
Jiro is offline   Reply With Quote
Old 03-30-2009, 01:04 AM   #19 (permalink)
Registered User
 
Join Date: Feb 2009
Location: Ohope Beach - New Zealand
Posts: 32
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...
kiwichris83 is offline   Reply With Quote
Old 03-30-2009, 01:05 AM   #20 (permalink)
YOU DOMESTIC DISSENT!
 
Jiro's Avatar
 
Join Date: Apr 2007
Location: The Sopranos State
Posts: 22,913
Quote:
Originally Posted by JClarke View Post
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.
__________________
- Don't forget to buy Jiro's Special Edition Sunglasses for $19.95
Jiro is offline   Reply With Quote
Old 03-30-2009, 01:05 AM   #21 (permalink)
Good times, good times.
 
JClarke's Avatar
 
Join Date: Nov 2006
Location: Packing bags for U.S.A
Posts: 20,207
Blog Entries: 5
Ok - Epic fail for me ---
__________________
JClarke is offline   Reply With Quote
Old 03-30-2009, 01:08 AM   #22 (permalink)
Registered User
 
Join Date: Feb 2009
Location: Ohope Beach - New Zealand
Posts: 32
if it failed for u - what is the recommended course of action i should do?
as the main thing I want is a form that works....and is simple to make! lol...
i see u use dreamweaver - I've got the CS3 Package - would that do the job?....got it for Photoshop etc so yea.
kiwichris83 is offline   Reply With Quote
Old 03-30-2009, 01:10 AM   #23 (permalink)
YOU DOMESTIC DISSENT!
 
Jiro's Avatar
 
Join Date: Apr 2007
Location: The Sopranos State
Posts: 22,913
Quote:
Originally Posted by kiwichris83 View Post
if it failed for u - what is the recommended course of action i should do?
as the main thing I want is a form that works....and is simple to make! lol...
i see u use dreamweaver - I've got the CS3 Package - would that do the job?....got it for Photoshop etc so yea.
oh no no no. you're doing it just fine. I just want you to upload the code for your simple form. What you just showed us is the process code.
__________________
- Don't forget to buy Jiro's Special Edition Sunglasses for $19.95
Jiro is offline   Reply With Quote
Old 03-30-2009, 01:13 AM   #24 (permalink)
Registered User
 
Join Date: Feb 2009
Location: Ohope Beach - New Zealand
Posts: 32
Ohhh OK i see...

the form page is at New Page 1


and just realised I'm talking 2 two ppl on here about it haha - i'm going crazy, am holding my 3 month old daughter at the same time so missus can cook T....so if i dont make sense then sorry!
kiwichris83 is offline   Reply With Quote
Old 03-30-2009, 01:13 AM   #25 (permalink)
Good times, good times.
 
JClarke's Avatar
 
Join Date: Nov 2006
Location: Packing bags for U.S.A
Posts: 20,207
Blog Entries: 5
I'll let Jiro help you, since he knows more PHP coding than I do, I mostly know C++ and HTML coding.
__________________
JClarke is offline   Reply With Quote
Old 03-30-2009, 01:14 AM   #26 (permalink)
YOU DOMESTIC DISSENT!
 
Jiro's Avatar
 
Join Date: Apr 2007
Location: The Sopranos State
Posts: 22,913
Quote:
Originally Posted by JClarke View Post
I'll let Jiro help you, since he knows more PHP coding than I do, I mostly know C++ and HTML coding.
my php skill is still basic
__________________
- Don't forget to buy Jiro's Special Edition Sunglasses for $19.95
Jiro is offline   Reply With Quote
Old 03-30-2009, 01:15 AM   #27 (permalink)
Registered User
 
Join Date: Feb 2009
Location: Ohope Beach - New Zealand
Posts: 32
thanks geaps 4 ur help jclarke
kiwichris83 is offline   Reply With Quote
Old 03-30-2009, 01:15 AM   #28 (permalink)
YOU DOMESTIC DISSENT!
 
Jiro's Avatar
 
Join Date: Apr 2007
Location: The Sopranos State
Posts: 22,913
Quote:
Originally Posted by kiwichris83 View Post
Ohhh OK i see...

the form page is at New Page 1


and just realised I'm talking 2 two ppl on here about it haha - i'm going crazy, am holding my 3 month old daughter at the same time so missus can cook T....so if i dont make sense then sorry!
don't worry, my man. I'm looking at your code..... processing..... processing..... LOL
__________________
- Don't forget to buy Jiro's Special Edition Sunglasses for $19.95
Jiro is offline   Reply With Quote
Old 03-30-2009, 01:23 AM   #29 (permalink)
YOU DOMESTIC DISSENT!
 
Jiro's Avatar
 
Join Date: Apr 2007
Location: The Sopranos State
Posts: 22,913
i copied the code and had it sent to me. it works. I did receive email but there's no information in it. that means we have to tweak the form just a bit.
__________________
- Don't forget to buy Jiro's Special Edition Sunglasses for $19.95
Jiro is offline   Reply With Quote
Old 03-30-2009, 01:28 AM   #30 (permalink)
YOU DOMESTIC DISSENT!
 
Jiro's Avatar
 
Join Date: Apr 2007
Location: The Sopranos State
Posts: 22,913
clarification - both codes (form and process) are correct but problem is... both are not designed to work with each other LOL! I'll have to create process code to work with your form
__________________
- Don't forget to buy Jiro's Special Edition Sunglasses for $19.95
Jiro is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 04:33 AM.


Join AllDeaf on Facebook!    Follow us on Twitter!

All text, images, and other content are Copyright © 2002-2009 by AllDeaf.com. All Rights Reserved.
vBulletin® Version 3.8.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.