www.webdeveloper.com
Page 2 of 2 FirstFirst 12
Results 16 to 27 of 27

Thread: [RESOLVED] HTML Form issues

  1. #16
    Join Date
    Jun 2013
    Posts
    36
    You don't have to worry about figuring out how to do the group thing, think of it as if we are sending an email to one more individual outside of the branch managers. I will create a distribution list on our exchange server for the 4 people. I just need to have the groupdl@gmail.com (of the 4 individuals) added to code somehow, like a mailto:cc=groupdl@gmail.com

    How does the branch manager actually receive an email? In other words do I replace the $R_branch and $S_branch with their actual emails like so:

    $R_email@email.com = trim(stripslashes(htmlspecialchars ($_POST['R_boston'])));
    $R_email@email.com = trim(stripslashes(htmlspecialchars ($_POST['R_columbia'])));
    etc.

    $S_email@email.com = trim(stripslashes(htmlspecialchars ($_POST['S_boston'])));
    $S_email@email.com = trim(stripslashes(htmlspecialchars ($_POST['S_columbia'])));
    etc.

    or is it like this? OR something completely different? I feel like I'm missing something.

    $R_boston = trim(stripslashes(htmlspecialchars ($_POST['email@email.com'])));
    $R_columbia = trim(stripslashes(htmlspecialchars ($_POST['email@email.com'])));
    etc.

    $S_boston = trim(stripslashes(htmlspecialchars ($_POST['S_email@email.com'])));
    $S_columbia = trim(stripslashes(htmlspecialchars ($_POST['S_email@email.com'])));
    etc.

    Thanks

  2. #17
    Join Date
    Aug 2012
    Location
    TX
    Posts
    293
    ya its easy i just did this for someone else today on here... look you just have the huge 12 city array thing thats making it hard. check this out so you will understand a little better

    see at bottom of my code how i sent a second email on success.
    http://www.webdeveloper.com/forum/sh...55#post1274055

  3. #18
    Join Date
    Jun 2013
    Posts
    36
    Quote Originally Posted by Nicholas Diaz View Post
    ya its easy i just did this for someone else today on here... look you just have the huge 12 city array thing thats making it hard. check this out so you will understand a little better

    see at bottom of my code how i sent a second email on success.
    http://www.webdeveloper.com/forum/sh...55#post1274055
    I will review this code in a bit, I wish I could show you what my form actually looks like but I think you get the idea.

    Here is another kicker -
    I have a table with Stock Number, Serial Number & Description (with text fill-in boxes that are below the headings) then there is an Add Row option. As I mentioned before, if the rep wants to order more than one piece of equipment they need to select Add Row for another set of text fields to be filled in. At that point I will also need the additional equipment to be submitted to the branch managers. Will the php form do this as well?

    Thanks - we can mess with this some more tomorrow.

  4. #19
    Join Date
    Aug 2012
    Location
    TX
    Posts
    293
    see this is why getting the whole scope of work.. we probably need to talk about what your doing cause we might have to build this a little more in depth then you think

  5. #20
    Join Date
    Jun 2013
    Posts
    36
    Quote Originally Posted by Nicholas Diaz View Post
    see this is why getting the whole scope of work.. we probably need to talk about what your doing cause we might have to build this a little more in depth then you think
    this project has been pretty crazy, something that I thought would be simple really didn't turn out that way. Have a good evening, I have to go rest and think about all of this

  6. #21
    Join Date
    Aug 2012
    Location
    TX
    Posts
    293
    ok i almost have this working. basicaly we have the array set up all we are lacking is the prepare email area working. I am not sure how to add the $to method and then implode the email variables in the email statement correctly. If someone could take a look at this and tell me what im missing to make the email function work when submit is clicked then i would appreciate it. All we need is the to function to init and then use the statement at the bottom to send the contents of the form to the R_email and the S_email.


    and on a positive note... adding the four static emails to this email is easy all we have to do is type them and put commas between them or make another email statement calling the first one $success and then next one will be if == $success then we write out the same email statement with the four emails u have seperated by commas. and were done! so close!!! someone help i cant stand this not working it should not of taken this long already....


    Code:
      <?php 
    sleep(2);
    //Sanitize incoming data and store in variable
    
    $stockNumber =  trim(stripslashes(htmlspecialchars ($_POST['stockNumber'])));		
    $serialNumber =  trim(stripslashes(htmlspecialchars ($_POST['serialNumber'])));	
    $description =  trim(stripslashes(htmlspecialchars ($_POST['description'])));	
    $from = trim(stripslashes(htmlspecialchars ($_POST['requestedBy'])));	
    $requestedDate =  trim(stripslashes(htmlspecialchars ($_POST['requestedDate'])));	
    $customerName =  trim(stripslashes(htmlspecialchars ($_POST['customerName'])));	
    $message =  trim(stripslashes(htmlspecialchars ($_POST['message'])));	
    
    // Array for the R_emails option from form
    $R_emails = array(
        'R_boston' => 'boston@test.com.com', 
        'R_columbia' => 'columbia@test.com', 
        'R_raleigh' => 'raleigh@emailhere.com',
    	'R_orlando' => 'test@email.com', 
        'R_topeko' => 'columbia@emailhere.com',
        'R_toledo' => 'raleigh@emailhere.com',
    	'R_cinncinatti' => 'test@email.com', 
        'R_dallas' => 'columbia@emailhere.com',
        'R_buffalo' => 'raleigh@emailhere.com',
    	'R_kansas' => 'test@email.com', 
        'R_fairfax' => 'columbia@emailhere.com', 
        'R_la' => 'raleigh@emailhere.com',
    );
    
    // get receiving email and turn in the the R_email variable
    $R_email = $R_emails[ $_POST['R_branch'] ];	
    
    // Array for the S_emails option from form
    $S_emails = array(
        'S_boston' => 'boston@test.com', 
        'S_columbia' => 'columbia@test.com', 
        'S_raleigh' => 'raleigh@emailhere.com',
    	'S_orlando' => 'test@email.com', 
        'S_topeko' => 'columbia@emailhere.com', 
        'S_toledo' => 'raleigh@emailhere.com',
    	'S_cinncinatti' => 'test@email.com', 
        'S_dallas' => 'columbia@emailhere.com', 
        'S_buffalo' => 'raleigh@emailhere.com',
    	'S_kansas' => 'test@email.com', 
        'S_fairfax' => 'columbia@emailhere.com', 
        'S_la' => 'raleigh@emailhere.com',
    );
    
    // get receiving email and turn in the the S_email variable
    $S_email = $S_emails[ $_POST['S_branch'] ];	
    
    
    
    //Prepare information from form to be sent 
    $to = 'admin@test.com';
    $from = 'admin@test.com';
    $headers = 'MIME-VERSION: 1.0' . '\n';
    $headers .= 'From: $from' . '\n';
    $subject = 'Online Order Request';
    $body = 'Stock Number: ' .$stockNumber . PHP_EOL;
    $body .= 'Serial Number: ' .$serialNumber . PHP_EOL;
    $body .= 'Description: ' .$description . PHP_EOL;
    $body .= 'Requested Date: ' .$requestedDate . PHP_EOL;
    $body .= 'Customer Name: ' .$customerName . PHP_EOL;
    $body .= 'Message: ' .$message . PHP_EOL;
    
    // Form data was successful so we will now send admin email and return message to the user
    $success = mail( implode(',', array( $R_email, $S_email ), $subject, $body, $headers , '-f admin@test.com.com') ); 
    	echo 'Thank you, your request has been sent!';				  
    	
    ?>
    Last edited by Nicholas Diaz; 06-23-2013 at 10:03 PM.

  7. #22
    Join Date
    Jun 2013
    Posts
    36

    error msg

    Quote Originally Posted by Nicholas Diaz View Post

    //Prepare information from form to be sent
    $to = 'admin@test.com';
    $from = 'admin@test.com';
    $headers = 'MIME-VERSION: 1.0' . '\n';
    $headers .= 'From: $from' . '\n';
    $subject = 'Online Order Request';
    $body = 'Stock Number: ' .$stockNumber . PHP_EOL;
    $body .= 'Serial Number: ' .$serialNumber . PHP_EOL;
    $body .= 'Description: ' .$description . PHP_EOL;
    $body .= 'Requested Date: ' .$requestedDate . PHP_EOL;
    $body .= 'Customer Name: ' .$customerName . PHP_EOL;
    $body .= 'Message: ' .$message . PHP_EOL;

    // Form data was successful so we will now send admin email and return message to the user
    $success = mail( implode(',', array( $R_email, $S_email ), $subject, $body, $headers , '-f admin@test.com.com') );
    echo 'Thank you, your request has been sent!';

    ?> [/code]
    I changes all of the variable names to match my html code and where you had admin@test.com.com I put in my own email address. Is that what I should do there? Did you actually get yours to work?

    I'm getting the following error -

    Warning: implode() expects at most 2 parameters, 6 given in C:\xampp\htdocs\test\send.php on line 67

    Warning: mail() expects at least 3 parameters, 1 given in C:\xampp\htdocs\test\send.php on line 67
    Thank you, your request has been sent!

  8. #23
    Join Date
    Aug 2012
    Location
    TX
    Posts
    293
    No I was saying we have a few lines of code to fix I was posting what I had to see if someone would chime in and help. Ill have the last of it by today. R u gonna send me th emails?

  9. #24
    Join Date
    Jun 2013
    Posts
    36

    response

    Quote Originally Posted by Nicholas Diaz View Post
    No I was saying we have a few lines of code to fix I was posting what I had to see if someone would chime in and help. Ill have the last of it by today. R u gonna send me th emails?
    I wasn't planning on it, where I need to input my own emails for now we can just go with what you are using. As far as the distribution list of 4 additional folks we can refer to it as group@gmail.com.

    I hope this makes sense.

    Thanks

  10. #25
    Join Date
    Jun 2013
    Posts
    36
    Quote Originally Posted by sparkymom7 View Post
    Receiving the following error - any idea why?

    Warning: implode() expects at most 2 parameters, 6 given in C:\xampp\htdocs\test\send.php on line 67

    Warning: mail() expects at least 3 parameters, 1 given in C:\xampp\htdocs\test\send.php on line 67
    Thank you, your request has been sent!
    My final lines of code

    // Form data was successful so we will now send admin email and return message to the user
    $success = mail( implode(',', array( $R_email, $S_email ), $subject, $body, $headers , '-f user123@gmail.com') );
    echo 'Thank you, your request has been sent!';

    ?>

  11. #26
    Join Date
    Jun 2013
    Location
    Chandigarh
    Posts
    1
    Hi dear thanks for share this information here. I really appreciate your work. I wanna get a website designing in HTML, CSS,WS3 etc.

  12. #27
    Join Date
    Jun 2013
    Posts
    36
    I had parentheses in wrong spot, this code works.

    / Form data was successful so we will now send admin email and return message to the user
    $success = mail( implode(',', array( $R_email, $S_email )), $subject, $body, $headers , '-f admin@test.com' );
    echo 'Thank you, your request has been sent!';

    I was able to get rid of errors above, it appears as though form was submitted and email sent but no emails have been received.

    Anyone know of a way to test server to see why email didn't send? Is there specific line of code that can be added to my PHP code for testing against server? If so, is it at beginning of PHP code after
    <?php

    ??blah, blah, blah??

    Thanks

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles