Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

cant get this to work...

Options
  • 17-11-2011 11:16am
    #1
    Registered Users Posts: 459 ✭✭


    I have a contact form (contact.php) that only allows it's content to be sent to one address, the address is defined in a sub directory in config.php

    If I add:
    [PHP]include('../contact.php');[/PHP]
    To the beginning of config.php

    and I add a new form value in contact.php:
    [PHP] <label for=to><span class="mandatory">* </span>To:</label>
    <input type="text" name="to" id="to" value="" class="textfield" autocomplete="off"/>[/PHP]

    and change config.php $mailTo from static $mailTo = "sara@mydomain.ie";
    $mailTo .= "".$_POST."@mydomain.ie"";
    does not work.

    Peter, Sara etc all have accounts @mydomain.ie, so I want to be able to simply put 'Peter' in the To: field of the form and the result being that config.php will get peter@mydomain.ie inserted into the $mailTo.

    I don't 100% understand the "".$_POST."" part as it is used in mail.php (code that sends the mail) to add a suffix to form fields ie.
    [PHP]$message .= "nessage: ".$_POST."";[/PHP]
    What I want to do is add a prefix...
    works --> $message .= "message: ".$_POST."";
    won't work --> $mailTo .= "".$_POST."@mydomain.ie"";


Comments

  • Registered Users Posts: 459 ✭✭CSU


    :(

    require_once was breaking the script so I include('../contact.php'); and gives error:

    Warning: include(../contact.php) [function.include]: failed to open stream: No such file or directory in E:\www\contact_lib\config.php on line 2


    Anyone got a mail script that has the ability to choose recipient?


  • Registered Users Posts: 6,440 ✭✭✭jhegarty


    The post isn't too clear.

    Which folders are the two files in ?


  • Registered Users Posts: 459 ✭✭CSU


    [WWW Root]
    contact.php
    ..[contact_lib]
    ..config.php

    E;

    sorry post is a mess - all I need to do is have the ability to:
    1. choose recipient (add form field To)
    2. insert recipient into config.php ($mailTo)
    3. Add prefix to $mailTo from form To field ($mailTo .= "".$_POST."@mydomain.ie""; )
    ^^ above code wont work :(
    ...

    any info on the interwebs always talks of a static $to string when sending mail...why can't I find info on dynamic mail $to string...


Advertisement