Jump to content

Recommended Posts

very new to php and i am not sure if this can even be done.  i would like to add a "default" value to the end of any value that a user enters into my form

The field is formated as this:

  $form['email_recipients'] = array(

    '#type' => 'textarea',

    '#title' => t('Send Message To'),

    '#default_value' => $node->email_recipients,

    '#cols' => 60,

    '#rows' => 6,

    '#description' => t('Use a comma or space to separate addresses. Make sure the above email addresses are valid to avoid campaign suspension.'),

    '#required' => TRUE,

  );

 

i would like for the user to enter for example just their username, and then have it automatically add @sitename.com to the value they enter once it is processed.  Is this possible?  If so, how in the world do i do it!?!?

 

many thanks

Link to comment
https://forums.phpfreaks.com/topic/176484-php-add-values-to-form-entry/
Share on other sites

i would have to see your code to give an exact answer, but whereever you assign the value of the post variable to a php variable, instead of doing

$username = $_POST['username'];

 

do

$username = $_POST['username'] . "@wherever.com";

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.