Copy form input values to hidden field- parse error

salmeronj 11 Sep, 2011
Dear ChronoEngine users,

I need help copy two input values into one hidden field.
I have search through the forum and have found the following code example, but I get a "
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' in /home/content/24/5041724/html/guyshroyer.com/CMS/components/com_chronocontact/libraries/customcode.php(64) : eval()'d code on line 4"

I want to populate the following field in my table,"SMS_email_address", with inputs from the fields "Cell" & "C_Carrier". this would allow me to send emails to cell phones as if i am sending a SMS messages.

I have added the place holder to form html code:
<input type='hidden' name='SMS_email_address' id='' value='' /> 


And i have added the following code to "OnSubmit before email":
<?php
$inputs = array(
  'Cell' => ''
  'C_Carrier' => ''
);
foreach ( $inputs as $k => $v ) {
  $inputs[$k] = JRequest::getString($k, '', 'post');
}
$SMS_email_address = implode('#', $inputs);
JRequest::setVar('SMS_email_address', $SMS_email_address);
?>


info above from: http://www.chronoengine.com/forums.html?cont=posts&f=2&t=21795&p=72649&hilit=hidden+field#p72649

I appreciate any help! Thanks!

Josue Salmeron
GreyHead 15 Sep, 2011
Hi salmeronj,

You need a comma separator between the array elements here (see 'Cell' => '', )
$inputs = array(
  'Cell' => '',
  'C_Carrier' => ''
);

Bob
salmeronj 19 Sep, 2011
Dear Bob,

Thank you so much!

Best,
Josue Salmeron
This topic is locked and no more replies can be posted.