SitePoint Sponsor

User Tag List

Results 1 to 15 of 15
  1. #1
    SitePoint Member TammieO's Avatar
    Join Date
    Aug 2003
    Location
    Mid-West USA
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PHP form to e-mail problem

    Hi,
    I don't know PHP at all. I had a very nice person help me with making a php form file that sends to an e-mail. It worked llike a dream.
    I have one problem though. When I tried adding a drop down box for people to select a date. That one item that I did, does not make it in the e-mail. I use DW MX to create the form element. Because I don't know PHP I don't even know where to begin to look for the problem Here is the section of code that was put in by me and yes it does appear in the form tag.
    (I hope I followed the posting instructions correctly)

    PHP Code:
    <p> &nbsp;&nbsp;&nbsp;Select a Date
                <
    select name="Select A Date" id="Select A Date">
                  <
    option value="Aug 5th" selected>August 5th</option>
                  <
    option value="Aug 12th">August 12th</option>
                </
    select>
              </
    p
    Thanks,

    Tammie

  2. #2
    Prolific Blogger silver trophy Technosailor's Avatar
    Join Date
    Jun 2001
    Location
    Before These Crowded Streets
    Posts
    9,446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    give the select name a single word for the name....like selectdate. Add square brackets. The line would look like this
    Code:
    <select name="selectdate[]" id="selectdate">
    Aaron Brazell
    Technosailor



  3. #3
    SitePoint Member TammieO's Avatar
    Join Date
    Aug 2003
    Location
    Mid-West USA
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It now looks like this but still does not work.

    PHP Code:
      Select a Date
                <
    select name="selectdate[]" id="selectdate">
                  <
    option value="Aug 7th">August 7th</option>
                  <
    option value="Aug 14th">August 14th</option>
                </
    select

  4. #4
    Prolific Blogger silver trophy Technosailor's Avatar
    Join Date
    Jun 2001
    Location
    Before These Crowded Streets
    Posts
    9,446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I believe you'd call the variable as $selectdate[0] after it has been passed.

    Do a print_r($selectdate) just to be sure (so you can see what is actually in the array).
    Aaron Brazell
    Technosailor



  5. #5
    SitePoint Member TammieO's Avatar
    Join Date
    Aug 2003
    Location
    Mid-West USA
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I tried witht he following:


    PHP Code:
      <select name="$selectdate[0]id="selectdate">
                  <
    option value="Aug 7th">August 7th</option>
                  <
    option value="Aug 14th">August 14th</option>
                </
    select
    Since I know NOTHING of php I don't understand about the print_r (selectdate) thing. Where do I put it.
    Also you said after it has been passed. How do I go in and check that out? I use DW and am going into the code to make these changes. It has crashed DW a few times while trying to make the changes to the php file in the WYSIWYG view.

    Thanks!
    Tammie

  6. #6
    Prolific Blogger silver trophy Technosailor's Avatar
    Join Date
    Jun 2001
    Location
    Before These Crowded Streets
    Posts
    9,446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok, when you do print_r() then you are printing out the contents of an array. Actually, now that I'm thinking of it, there should be no reason to put a <select> in an atray. There is only one possible value. Anyway I can see your actual form code and the actual PHP you are using to process it? Something's not right. By the way, your last posting's syntax wa wrong, but we'll look at the whole code...
    Aaron Brazell
    Technosailor



  7. #7
    Prolific Blogger silver trophy Technosailor's Avatar
    Join Date
    Jun 2001
    Location
    Before These Crowded Streets
    Posts
    9,446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Understanding that vbulletin screws up PHP, change:
    Code:
    <select name="$selectdate[0]" id="selectdate">
    to
    Code:
    <select name="selectdate">
    and after you do your extract, you should be able to access the variable with $selectdate. Forgive my ignorance, but where exactly are you trying to call it? I don't see it.

    Aaron
    Aaron Brazell
    Technosailor



  8. #8
    SitePoint Member TammieO's Avatar
    Join Date
    Aug 2003
    Location
    Mid-West USA
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am trying to make a drop down box that allows people to select a date for a class. Is that what your question was about? <option value="Aug 7th">August 7th</option>
    <
    option value="Aug 14th">August 14th</option
    >

    I used DW to try and plug this in. Is there some type of plug in for DW or will I need to learn to code it myself?

  9. #9
    Prolific Blogger silver trophy Technosailor's Avatar
    Join Date
    Jun 2001
    Location
    Before These Crowded Streets
    Posts
    9,446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No, I understand that. But once the form is submitted, where are you calling the variable.

    Look at what you have...
    PHP Code:
    <?php
    define 
    ('RECIPIENT''image@itsaboutimage.com');
    define ('SUBJECT''Register For Classes');
    if (
    $_REQUEST['do_form'] == 1) {
        
    extract ($_REQUESTEXTR_OVERWRITE);
        
        
    $message  "First Name: $first_namen";
        
    $message .= "Last Name: $last_namen";
        
    $message .= "Phone Number: $phone_numbern";
        
    $message .= "E-mail Address: $email_addressn";
        
    $message .= "Number Of Attendees: $attendeesn";
        
    $message .= "Comments: $commentsn";
        
        if (
    mail (RECIPIENTSUBJECT$message"From: $first_name $last_namenReply-To: $email_address) == true) {

    ?>
    Where is $selectdate being used? I don't see it? Do this. Put this line at the vvery top within PHP tags...

    echo (empty($_POST['selectdate'])) ? '' : $_POST['selectdate'];

    If you get a date (one of the values from your dropdown) then you know your variable has been set. You just need to use it. If no, then there's other problems.

    Aaron
    Aaron Brazell
    Technosailor



  10. #10
    SitePoint Member TammieO's Avatar
    Join Date
    Aug 2003
    Location
    Mid-West USA
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Made the change

    I now have it like this and it does not show up in the e-mail.

    PHP Code:
       <select name="selectdate">
                  <
    option value="Aug 7th">August 7th</option>
                  <
    option value="Aug 14th">August 14th</option>
                </
    select

  11. #11
    Prolific Blogger silver trophy Technosailor's Avatar
    Join Date
    Jun 2001
    Location
    Before These Crowded Streets
    Posts
    9,446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Um yes. See post above. You are not including $selectdate in the email. Forget the HTML. Look at the PHP.
    Aaron Brazell
    Technosailor



  12. #12
    SitePoint Member TammieO's Avatar
    Join Date
    Aug 2003
    Location
    Mid-West USA
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I tried the echo thing and it did not work, but I think I am starting to understand why you are saying you can't find it. I added this drop down box with DW like I do with a regular web page. Because this is PHP someting needs to go in the PHP at the top like some java script goes in the head and the body. Am I getting warm?

  13. #13
    Prolific Blogger silver trophy Technosailor's Avatar
    Join Date
    Jun 2001
    Location
    Before These Crowded Streets
    Posts
    9,446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    swap out the echo with
    Edit:


    if(!empty($_POST['selectdate']))
    {
    print_r($_POST);
    exit;
    }
    Try that.

    Also, you are submitting the form to itself, right? in the HTML <forM action is set to <?php echo $_SERVER['PHP_SELF'] ?> correct?
    Aaron Brazell
    Technosailor



  14. #14
    SitePoint Member TammieO's Avatar
    Join Date
    Aug 2003
    Location
    Mid-West USA
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The form is submitting to an e-mail address
    Does this help?
    <form action="mailer.php" method="post">
    <input name="do_form" type="hidden" value="1">

  15. #15
    Prolific Blogger silver trophy Technosailor's Avatar
    Join Date
    Jun 2001
    Location
    Before These Crowded Streets
    Posts
    9,446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If that's the case then the PHP code on the top of your code is useless and I'm not sure why it's there. You need to show me mailer.php. Thanks.

    Aaron
    Aaron Brazell
    Technosailor




Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •