Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Oct 2003
    Posts
    603
    Thanks
    2
    Thanked 1 Time in 1 Post

    getting all POST vars

    can you have it so that you can have variable amounts and names of POST variables inserted into an email? i have this code that people can go to and have their forms submit to their emails via the accounts in the databases but some people have more fields and different names for their fields in each account... i need it to submit every field to the email.. is this possible?

  • #2
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i need it to submit every field to the email.. is this possible?
    What do you mean?

    You can do a
    PHP Code:
    $mailcontent='';
    foreach(
    $_POST as $var=>$value){
      
    $mailcontent .='<br />'.$value;

    which will build a string with all posted values.
    I ussually then start all my content-formfields with the same letters (or different groups of letters) so that you can elimitad the submitbutton ets-c. then you have something like

    PHP Code:
    $mailcontent='';
    $mailsubject='';
    foreach(
    $_POST as $var=>$value){
        if (
    substr($var,0,4)=='cont'){ 
           
    $mailcontent .='<br />'.$value;
        }elseif (
    substr($var,0,4)=='subj'){ 
           
    $mailsubject .='<br />'.$value;
        }

    Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html


  •  

    Posting Permissions

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