Hi jrthor2,
Joomla provides some code for accessing the variables from the $_REQUEST arrays (post, get, cookie) that includes some input filtering and so is a bit more secure than accessing the arrays directly.
The main functions are:
$param = JRequest::getVar('param_name', 'default_value, 'source');
where you can replace getVar with e.g. getString, getInt, getCmd, getWord, to add more validation. (See the full method list
here).
The equivalent for writing values is
JRequest::setVar('param_name', $param_value);
So in long form your code would look like
<?php
$area_code = JRequest::getInt('phone_number_area_code', '', 'post');
$phone1 = JRequest::getInt('phone_number1', '', 'post');
$phone2 = JRequest::getInt('phone_number2', '', 'post');
$phone_number = $area_code."-".$phone1."-".$phone2;
JRequest::setVar('phone_number', $phone_number, 'post');
?>
though I'd more likely write something along these lines
<?php
$phone_array = array('phone_number_area_code' => '', 'phone_number1' => '' => '', 'phone_number2');
foreach ( $phone_array as $k => $v ) {
$phone_array[$k] = JRequest::getInt($k, '', 'post');
}
JRequest::setVar('phone_number', implode('-', $phone_array), 'post');
?>
Bob