Welcome Guest!

If you do not have an account yet on The Web Squeeze forums, please Register! It’s FREE and there are many benefits:

  • Receive Fast Advice
  • Learn Programming Languages
  • Get Professional Website Reviews
  • Quick Troubleshooting Assistance

> Php Newbie - How To Use A Php Script To Send A Form

This is a discussion on Php Newbie - How To Use A Php Script To Send A Form, within the PHP section. This forum and the thread "Php Newbie - How To Use A Php Script To Send A Form" are both part of the Programming Your Website category.

 
Reply to this topicStart new topic
> Php Newbie - How To Use A Php Script To Send A Form
PandaDesign
post May 15 2008, 12:06 PM
Post #1


Fresh Squeezed
**

Group: Members
Posts: 13
Joined: 16-February 08
From: Boston, MA
Member No.: 164



Hi

I am trying to learn PHP but I am not too good yet... My problem is that I need to figure out how to send a form from a client's website to her e-mail address. The form is fairly simple with a couple of basic questions and checkboxes. I have googled and found plenty of tutorials but they do not seem to work. I am not sure if this has to do with my host (GoDaddy) or not.

At any rate, does anyone know of a good tutorial site that shows a beginner how to send a form using PHP? Or maybe there is a simpler way I could do it? I am so frustrated and I need to get this website up and running.

Any suggestions are greatly appreciated!
Go to the top of the page
 
+Quote Post
karinne
post May 15 2008, 12:33 PM
Post #2


Co-Founder
*******

Group: Co-Founders
Posts: 2,799
Joined: 13-February 08
From: Squeezin'
Member No.: 2



What about the 2 stickies in this forum?


--------------------
The Squeeze Store is now OPEN! Come on in and grab something!

a web design portfolio | web non-sense - REDESIGNED!
I'm also on: del.icio.us | flickr | virb | facebook | twitter
The Web Squeeze is also on: virb | facebook | stumbleupon - JOIN IN!
Go to the top of the page
 
+Quote Post
weasel2006
post May 15 2008, 05:42 PM
Post #3


Fresh Squeezed
**

Group: Members
Posts: 14
Joined: 14-February 08
Member No.: 130



Making sure to secure it to high heaven.. Last think you want is some malicious goon destroying all your hard work.
Do a search for email injection for some basic info on how to secure web forms smile.gif

I've just done a form myself which uses sessions to manage errors..

If you get stuck, PM me and I'll try and help as best I can.
I try to get on here at least once a day, so please be patient if I don't respond immediately smile.gif

Regards,

Weasel
Go to the top of the page
 
+Quote Post
Justify
post May 15 2008, 05:46 PM
Post #4


Squeezing
***

Group: Members
Posts: 96
Joined: 14-February 08
Member No.: 76



Hi there,

I think your problem might be that as far as i know GoDaddy doesn't come with php installed...

If that's the case, there are ways of getting around that. Something called form mailer.

Is the page with the script just coming up in html when you upload it?
Go to the top of the page
 
+Quote Post
PandaDesign
post May 15 2008, 06:54 PM
Post #5


Fresh Squeezed
**

Group: Members
Posts: 13
Joined: 16-February 08
From: Boston, MA
Member No.: 164



Hhhmmm, how did I manage to look through the whole forum and miss the stickies?!?! In my defense, I was perusing before I had my first real caffeine of the day... I will try those and see if they work.

I am worried about it being secure as well. I will try that search and see what I get.
Go to the top of the page
 
+Quote Post
karinne
post May 15 2008, 06:58 PM
Post #6


Co-Founder
*******

Group: Co-Founders
Posts: 2,799
Joined: 13-February 08
From: Squeezin'
Member No.: 2



I'm pretty sure Rakuli's and Jan's scripts are pretty secure... they are usually pretty good for that stuff wink.gif


--------------------
The Squeeze Store is now OPEN! Come on in and grab something!

a web design portfolio | web non-sense - REDESIGNED!
I'm also on: del.icio.us | flickr | virb | facebook | twitter
The Web Squeeze is also on: virb | facebook | stumbleupon - JOIN IN!
Go to the top of the page
 
+Quote Post
c010depunkk
post May 16 2008, 01:22 AM
Post #7


Rapid Squeezer
****

Group: Advisors
Posts: 178
Joined: 14-February 08
From: Willich, Germany
Member No.: 56



QUOTE (karinne @ May 16 2008, 01:58 AM) *
I'm pretty sure Rakuli's and Jan's scripts are pretty secure... they are usually pretty good for that stuff wink.gif

aawww, thanks biggrin.gif

To be quite honest, my script doesn't even have a Captcha, so it doesn't even prevent spamming.... BUT, i have had this contact form running on my website for over a year now, i get 2-3 contact mails a week, and no spam at all.... If you're really serious about security, then I would suggest adding a Captcha.


--------------------
www.c010depunkk.com ~ the hangout of a web developer
Go to the top of the page
 
+Quote Post
PandaDesign
post May 19 2008, 01:29 AM
Post #8


Fresh Squeezed
**

Group: Members
Posts: 13
Joined: 16-February 08
From: Boston, MA
Member No.: 164



Help!!!

I tried both forms and am still having problems. I tried the forms by c010depunkk and Rakuli. The one by c010depunkk technically worked but it didn't manage to send most of my information. I think I had trouble configuring it to my specific form. Anyway, I tried Rakuli's which has a form that is similar to mine and now all I am getting is error messages. I got a syntax error message when I tried to combine the form and the PHP. When I separated it I got the following error message:
Parse error: syntax error, unexpected $end in C:\Inetpub\vhosts\pandapreview.com\httpdocs\contact.php on line 271

I have included the two files that I have now. I am really feeling like a moron right about now. I am very new to PHP and have not had the time to learn much recently. I am positive this is user error but I can't seem to find where (besides between the keyboard and the chair sarcastic_hand.gif but knowing that doesn't really help me)

Anyway, thanks for anything you can give me....





This post has been edited by PandaDesign: May 19 2008, 01:30 AM
Attached File(s)
Attached File  contact.php ( 5.59K ) Number of downloads: 2
Attached File  contact.html ( 2.89K ) Number of downloads: 1
 
Go to the top of the page
 
+Quote Post
Jason
post May 19 2008, 02:04 AM
Post #9


Master of the Universe
******

Group: Advisors
Posts: 1,157
Joined: 15-February 08
From: London, England
Member No.: 141



Unexpected end means that you have more open brackets than closed brackets.

The error is right at the bottom of your script.

CODE
if (count($errors))
{
?>


--------------------
Go to the top of the page
 
+Quote Post
Rakuli
post May 19 2008, 03:29 AM
Post #10


Squeeze Machine
*****

Group: Administrators
Posts: 649
Joined: 13-February 08
From: Catching the squeezed drips downunder.
Member No.: 13



Hi Panda,

You are missing quite a few lines from the script after the spot that Jason pointed out. If you take a look at the file I uploaded to my post you'll see the logic that comes after that line.

Cheers


--------------------
Luke Dingle . com

Turn Over a Playful Leaf on Web Design -- read about the javascript cat
Go to the top of the page
 
+Quote Post
PandaDesign
post May 19 2008, 01:10 PM
Post #11


Fresh Squeezed
**

Group: Members
Posts: 13
Joined: 16-February 08
From: Boston, MA
Member No.: 164



Eh....still not working. I added the script I was missing on the end and took off that end tag.

Anyway, it won't even see the PHP at this point. It just says it can't find the document?
Attached File(s)
Attached File  contact.php ( 6.22K ) Number of downloads: 6
 
Go to the top of the page
 
+Quote Post
Rakuli
post May 20 2008, 10:46 PM
Post #12


Squeeze Machine
*****

Group: Administrators
Posts: 649
Joined: 13-February 08
From: Catching the squeezed drips downunder.
Member No.: 13



Change this part of the code to

CODE
if (count($errors))

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Some Bad Things Went Down</title>
</head>

<body>
<?php
    echo '<div style="border: solid 1px red;padding: 2em;">
        <h1 style="font-size: 1.2em;">Some Errors Occurred</h1>
        <ul>';
    
    foreach ($errors as $err)
        echo '<li>', $err, '</li>';
        
        echo '</ul>
        <a href="', $returnURL , '" onclick="window.history.back(); return false;">Go Back and try again</a>
        </div>';
?>
</body></html>
<?php

?>


to:

CODE
if (count($errors))
{
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Some Bad Things Went Down</title>
</head>

<body>
<?php
    echo '<div style="border: solid 1px red;padding: 2em;">
        <h1 style="font-size: 1.2em;">Some Errors Occurred</h1>
        <ul>';
    
    foreach ($errors as $err)
        echo '<li>', $err, '</li>';
        
        echo '</ul>
        <a href="', $returnURL , '" onclick="window.history.back(); return false;">Go Back and try again</a>
        </div>';
?>
</body></html>
<?php
}
?>


--------------------
Luke Dingle . com

Turn Over a Playful Leaf on Web Design -- read about the javascript cat
Go to the top of the page
 
+Quote Post
PandaDesign
post May 21 2008, 12:16 AM
Post #13


Fresh Squeezed
**

Group: Members
Posts: 13
Joined: 16-February 08
From: Boston, MA
Member No.: 164



Thanks for the help. I did what you said but now I am getting this message:

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in C:\Inetpub\vhosts\pandapreview.com\httpdocs\contact.php on line 284

According to BBEdit, this is line 284:
<ul>';
Go to the top of the page
 
+Quote Post
c010depunkk
post May 21 2008, 12:56 AM
Post #14


Rapid Squeezer
****

Group: Advisors
Posts: 178
Joined: 14-February 08
From: Willich, Germany
Member No.: 56



check your quotation marks.... are you closing all the strings you opened and vice versa...

(sorry, wold write more, but i gotta run --> off to college) biggrin.gif


--------------------
www.c010depunkk.com ~ the hangout of a web developer
Go to the top of the page
 
+Quote Post
Rakuli
post May 21 2008, 03:29 AM
Post #15


Squeeze Machine
*****

Group: Administrators
Posts: 649
Joined: 13-February 08
From: Catching the squeezed drips downunder.
Member No.: 13



I just tried that script on my server and it works... Does the error occur when you submit the form?


--------------------
Luke Dingle . com

Turn Over a Playful Leaf on Web Design -- read about the javascript cat
Go to the top of the page
 
+Quote Post
PandaDesign
post May 21 2008, 05:12 PM
Post #16


Fresh Squeezed
**

Group: Members
Posts: 13
Joined: 16-February 08
From: Boston, MA
Member No.: 164



Yeah, that's what I get when I submit the form. Maybe it is a problem with GoDaddy? I went in and manually turned on PHP but I have not messed with any of the other settings on my server. I got c010depunkk's version to actullay e-mail me but most of the information was missing...

Well, at any rate I do appreciate the help. Thanks!
Go to the top of the page
 
+Quote Post
If you found The Web Squeeze to be helpful, please donate so we can keep this site FREE, FRESH, and fortified with Web Design & Development info!
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Collapse

> Similar Topics

    Topic Title Replies Topic Starter Views Last Action
No New Posts   11 PandaDesign 156 19th February 2008 - 03:17 PM
Last post by: rewake
No New Posts   9 PoetAlley 298 17th February 2008 - 06:27 PM
Last post by: PoetAlley
No New Posts 12 xkatx21x 531 28th February 2008 - 11:41 PM
Last post by: Rakuli
No New Posts 7 Webmaster 505 27th August 2008 - 12:40 PM
Last post by: rich97
No New Posts   4 thesealportalteam 352 20th February 2008 - 09:00 AM
Last post by: thesealportalteam