Re: Having trouble with a form to mail script.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> Hi there,
> Well, after reading the post about "so called experts" and licensing programming, I
> can say that I sure am not licensed or even remotely close to a novice PHP
> programmer, just a ‘lil ole PHP beginner trying to get my web page set up and
> learn a few things.  I’m not sure if I am
> in the right forum but thought I would give this a shot…
>
> I just
> created a new mail form in Dreamweaver for a web site.  I’m
> working on a form to mail script that I started after reading a few on line tutorials, and can’t seem to get right. When I run
> this little test script (named sendmail2.php) from the tutorial, on my server,
> just to make sure PHP is working OK for web email forms:
>
> <?php
> $email = $_REQUEST['email'] ;
>
> $message = $_REQUEST['message'] ;
>
> mail( "help@xxxxxxxxxxxx", "Feedback Form Results",
>
> $message, "From: $email" );
>
> header( "Location: http://www.mydomain.com/thankyou.html";
> );
>
> ?>
>
>
>
> Which takes
> input from the following testmail.html page form:
>
>
>
> <form method="post"
> action="sendmail2.php">
>
> Email: <input name="email" type="text" /><br
> />
>
> Message:<br />
>
> <textarea name="message" rows="15"
> cols="40">
>
> </textarea><br />
>
> <input type="submit" />
>
> </form>
>
> It works
> great, I get the senders email address and comment sent to my email address –
> account.
> But the form
> I want to use my final design from Dreamweaver, is:
>
> <form id="formEmail"
> name="formEmail" method="post"
> action="sendmail2.php">
>
> <fieldset>
>
> <legend>Account Info:</legend>
>
> <label for="emailAddress">User Name:</label>
>
> <input type="text" name="emailAddress"
> id="emailAddress" tabindex="10" />
>
> <br />
>
> <label for="pwd">Password</label>
>
> <input type="text" name="pwd" id="pwd"
> tabindex="20" />
>
> <br />
>
> <label for="confirm">Confirm Password:</label>
>
> <input type="text" name="confirm"
> id="confirm" tabindex="30" />
>
> <br />
>
> </fieldset>
>
> <fieldset>
>
> <legend>Personal Info</legend>
>
> <br />
>
> <label for="firstname">First Name:</label>
>
> <input type="text" name="firstname"
> id="firstname" tabindex="40" />
>
> <br />
>
> <br />
>
> <label for="lastname">Last Name:</label>
>
> <input type="text" name="lastname"
> id="lastname" tabindex="50" />
>
> <br />
>
> <br />
>
> <label for="region">What state do you live
> in?</label>
>
> <select name="region" id="region"
> tabindex="60">
>
> <option value="al">Alabama</option>
>
> <option value="in">Indiana</option>
>
> <option value="mich"
> selected="selected">Michigan</option>
>
> <option value="oh">Ohio</option>
>
> </select>
>
> <br />
>
> <p> How long have u been sawing?</p>
>
> <label>
>
> <input type="radio" name="WoodLength"
> value="newbie" id="WoodLength_0" tabindex="70"
> />
>
> 0-2 years</label>
>
> <br />
>
> <label>
>
> <input type="radio" name="WoodLength"
> value="novice" id="WoodLength_1" tabindex="80"
> />
>
> 3-5 years</label></td>
>
> <br />
>
> <label>
>
> <input type="radio" name="WoodLength"
> value="expert" id="WoodLength_2"
> tabindex="90"/>
>
> 6 plus years</label><br />
>
> <p>What tools do you use most often?</p>
>
> <br />
>
> <input type="checkbox" name="shop"
> id="shop" tabindex="100" />
>
> <label for="shop">Shopping</label>
>
> <br />
>
> <input type="checkbox" name="tools"
> id="tools" tabindex="120" />
>
> <label for="tools">Tools</label>
>
> <br />
>
> <input type="checkbox" name="saws"
> id="saws" tabindex="130" />
>
> <label for="saws">Saws</label>
>
> <br />
>
>
>
> <label for="Comments">Additional Comments</label>
>
> <br />
>
> <textarea name="Comments" id="Comments"
> cols="50" rows="10"
> tabindex="140"></textarea>
>
> <br />
>
> <input type="submit" name="submit"
> id="Submit" value="Join Mail List" tabindex="160"
> />
>
> <br />
>
> </fieldset>
>
> </form>
>
>
>
> …and when I
> use it with the associated sendmail2.php script:
>
>
>
>
> <?php /*?>
>
> <?php
>
> $emailAddress = $_REQUEST['emailAddress'] ;
>
> $pwd = $_REQUEST['pwd'] ;
>
> $confirm = $_REQUEST['confirm'] ;
>
> $firstname = $_REQUEST['firstname'] ;
>
> $lastname = $_REQUEST['lastname'] ;
>
> $region = $_REQUEST['region'] ;
>
> $WoodLength = $_REQUEST['WoodLength'] ;
>
> $shop = $_REQUEST['shop'] ;
>
> $tools = $_REQUEST['tools'] ;
>
> $saws = $_REQUEST['saws'] ;
>
> $Comments = $_REQUEST['Comments'] ;
>
> mail( "help@xxxxxxxxxxxx", "Feedback Form Results",
>
> $message, "From: $email" );
>
> header( "Location: http://www.mydomain.com/thankyou.html";
> );
>
> ?>
>
>
>
> The email is
> received, but with a blank return email address and an empty message. None of
> the comments or form values get through - just a blank email sent to my
> address. Can anyone point me in the right direction – what am I doing wrong?
>
>
>
> Note: That
> password field is not really a login password, I just wanted to use it for
> testing purposes.
>
>
> Do I have to
> refrence the type and id attributes in the php script as well?
>
>
>
> Thanks for
> any input.

hi Linda,

change some parameters to the mail function:
mail( "help@xxxxxxxxxxxx", "Feedback Form Results", $comments, "From:
$emailAddress" );

if you want to include the other inputs, just concatenate them into $comments.

Virgil
http://www.jampmark.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux