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

adding information to form entries

Options
  • 30-08-2005 5:21pm
    #1
    Closed Accounts Posts: 223 ✭✭


    I'm using the basic preinstalled formmail cgi that comes with my hosting to email user entered information in a number of form fields, one of these being the "recipient" value to decide where the email goes. I have the cgi script configured to only send to email addresses within my own domain to avoid spammer hijacking but was wondering if there's anyway to automaticly add the "@domain.com" onto the user enetered information as this will be identical in every case, resulting in the user simply entering "bob" into the recipient field as opposed to "bob@domain.com".

    I've had a look at using a php mail form and while i've about cobbled together one that does pretty much the same thing as the cgi version I have i'm still not sure how to amend information onto submitted fields, is this at all possible without the use of some sort of databse backend?


Comments

  • Registered Users Posts: 9,579 ✭✭✭Webmonkey


    I don't know anything about cgi but once you've taken the value of the user you can use the cgi to create a new variable with value of user+"domain.com";

    with php you could use

    $user = $_REQUEST;
    $email = $user."@domain.com";

    and then in the mail() function or whatever you use use the email value. not that complicated.


  • Registered Users Posts: 32,136 ✭✭✭✭is_that_so


    Just append the domain.

    in PHP/PERL
    $domain='@domain.com';
    $mail=$username.$domain;


  • Closed Accounts Posts: 223 ✭✭telemachus


    Cheers for that, thankfully nice and simple :D , up until recently i'd been content to bury my head in the basics of nice safe static html or css if I was feeling unusually experimental, suddenly i've found myself dazzled and overwhelmed by the various interactive javascripts/php routes.


  • Registered Users Posts: 4,003 ✭✭✭rsynnott


    Webmonkey wrote:

    $user = $_REQUEST;
    $email = $user."@domain.com";

    is_that_so wrote:
    $domain='@domain.com';
    $mail=$username.$domain;


    Warning, warning; injection danger! (Possibly; especially if command-line invoking Sendmail). Some form of escaping may be indicated.


Advertisement