problem with my form script?

This is a discussion on "problem with my form script?" within the PHP Forum section. This forum, and the thread "problem with my form script? are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Jan 30th, 2008, 02:48
Junior Member
Join Date: Nov 2006
Location: new york
Age: 21
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
problem with my form script?

This is the first php I have ever written, and I want to check if its correct.

I created a form in dreamweaver that includes
-a text box
-a file upload
-three check boxes
-submit button.

I wrote this code in hopes to send the info to my e-mail address:
PHP: Select all

<?php
  $email 
$_REQUEST['Email'] ;
  
$file $_REQUEST['Image'] ;
  
$check1 $_REQUEST['1'] ;
  
$check2 $_REQUEST['2'] ;
  
$check3 $_REQUEST['3'] ;
  
$submit $_REQUEST['Submit'] ;


  
mail"info@changedforprivacy.com""New Sent Photo",
    
$message"From: $email" );
  
header"Location: http://www.changedforprivacy.com/SendSuccess.html);
?>
The form in dreamweaver has the action: process.php which is the name of the code file.

Is this looking correct?

I inputted everything into my hosting server, but it doesnt work, infact, while in firefox it opens up a blank mail window, and it never redirects anyone to the send success page. In internet explorer, when I mouseover the submit button, it shows an mailto e-mail address I had origionally tried adding, but I removed that yesterday, so i dont understand why its still showing up. Is it just the updates I make in dreamweaver dont take affect immediatly on the server?

Please help!


EDIT: wow I actually got it to work now, I just uploaded it in the wrong spot on the server, the mail went through, but the results of the form did not show up in the e-mail, and the sent file was not there either. So what should I do to my script to fix this? I'm completely puzzled.

Last edited by c010depunkk; Jan 30th, 2008 at 04:43. Reason: please use [PHP] tags when posting PHP
Reply With Quote

  #2 (permalink)  
Old Jan 30th, 2008, 12:38
Up'n'Coming Member
Join Date: Feb 2006
Location: London
Age: 25
Posts: 98
Thanks: 0
Thanked 0 Times in 0 Posts
Re: problem with my form script?

You need to assign a value to $message.

eg...

PHP: Select all

<?php
  $email 
$_REQUEST['Email'] ;
  
$file $_REQUEST['Image'] ;
  
$check1 $_REQUEST['1'] ;
  
$check2 $_REQUEST['2'] ;
  
$check3 $_REQUEST['3'] ;
  
$submit $_REQUEST['Submit'] ;

$message "
Email address = $email
Checkbox1 = $check1
Checkbox2 = $check2
Checkbox3 = $check3"
;

  
mail"info@changedforprivacy.com""New Sent Photo",
    
$message"From: $email" );
  
header"Location: http://www.changedforprivacy.com/SendSuccess.html);
?>
Attaching a file might be a bit tough for you, seeing as you're just starting out with php.

Give that a go without the file for now, and see if you get the rest of the data sent to you in an email.
Reply With Quote
  #3 (permalink)  
Old Jan 30th, 2008, 18:40
Reputable Member
Join Date: Dec 2005
Location: U.S.A.
Posts: 147
Thanks: 0
Thanked 3 Times in 3 Posts
Send a message via MSN to ScottR Send a message via Skype™ to ScottR
Re: problem with my form script?

Your next step is to start validating that data. Spammers will use that form to send out mass emails. Since your using $_REQUEST instead of $_POST (assuming your action is post), they can append extra data to the URL.
Reply With Quote
  #4 (permalink)  
Old Jan 30th, 2008, 18:52
Jack Franklin's Avatar
Resources Administrator

SuperMember
Join Date: May 2007
Location: Cornwall, England
Posts: 1,268
Blog Entries: 7
Thanks: 10
Thanked 4 Times in 4 Posts
Re: problem with my form script?

I find using $_POST is the best way to send the data, although I understand it is your first attempt. Can I see your html for the code please?
Last Blog Entry: My Latest Project - Grilling Gurus... (Jun 11th, 2008)
Reply With Quote
  #5 (permalink)  
Old Jan 30th, 2008, 23:10
Junior Member
Join Date: Nov 2006
Location: new york
Age: 21
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Re: problem with my form script?

heres the code for my form in dreamweaver:
HTML: Select all
<form action="process.php" method="post" enctype="multipart/form-data" name="Form" class="style1" id="Form">
      
    <div align="left">
            <blockquote>
              <p><span class="style11">E-mail:          </span>
                <input type="text" name="Email" id="Email" />
                <br />
                <span class="style6">I have text here</span><br />
                <br />
                <br />
                <span class="style11"> Image:</span>
                <input type="file" name="Image" id="Image" />
                <br />
                <br />
                <br />
                <span class="style12">more text here</span><br />
                <br />
                <input type="checkbox" name="1" id="1" />
                standard retouch  <br />
                <span class="style6">blah blah checkbox</span><br />
                <input type="checkbox" name="2" id="2" />
                anothercheckbox description<br />
                <input type="checkbox" name="3" id="3" />
                last checkbox<br />
                <br />
                More options will be added in the near future!<br />
                <br />
                <br />
                <input type="submit" name="Submit" id="Submit" value="Submit" />
                <span class="style6">final text</span><br />
                <br />
              </p>
            </blockquote>
          </div>
    </form>

Last edited by c010depunkk; Jan 31st, 2008 at 06:31. Reason: please use [HTML] tags when posting HTML
Reply With Quote
Reply

Thread Tools

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
form element disable script thenamenoonehastaken JavaScript Forum 1 Apr 21st, 2008 09:39
PHP Login Script / form prydie PHP Forum 0 Mar 27th, 2008 06:55
Anyone have a working search form script? daveg33 PHP Forum 12 Sep 28th, 2007 23:54
Need help please with PHP Form script mkidd PHP Forum 2 Jun 19th, 2007 10:27
PHP form mail script required... JohneeMac PHP Forum 7 Sep 27th, 2004 18:54


All times are GMT. The time now is 06:03.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43