calebm12 Posted October 4, 2009 Share Posted October 4, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/176484-php-add-values-to-form-entry/ Share on other sites More sharing options...
mikesta707 Posted October 4, 2009 Share Posted October 4, 2009 $username = "mikesta707"; $atWhere = "@phpfreaks.com"; $wholeAddress = $username . $atWhere; Quote Link to comment https://forums.phpfreaks.com/topic/176484-php-add-values-to-form-entry/#findComment-930311 Share on other sites More sharing options...
calebm12 Posted October 4, 2009 Author Share Posted October 4, 2009 thanks for the quick response. sorry for my ignorance. how would i build this into my form? Quote Link to comment https://forums.phpfreaks.com/topic/176484-php-add-values-to-form-entry/#findComment-930320 Share on other sites More sharing options...
mikesta707 Posted October 4, 2009 Share Posted October 4, 2009 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"; Quote Link to comment https://forums.phpfreaks.com/topic/176484-php-add-values-to-form-entry/#findComment-930331 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.