I’m outputting a “+” delimied string from flash (loadVars) to PHP
[COLOR=RoyalBlue]1+3+5+13+45[/COLOR]
I’m using regex to test if the string is valid. Using regexlib.com tester.
**[COLOR=RoyalBlue]Regex pattern: ^[0-9+]+$
1 (Match)
[/COLOR][COLOR=RoyalBlue]1+3+5+13+45[/COLOR][COLOR=RoyalBlue] (Match)
1+ (Match)[/COLOR]**
This is part of my PHP code.
$this->data = array('Enquiry' => array(
'name' => $_POST['fname'],
'from' => $_POST['femail'],
'address' => $_POST['faddress'],
'tel' => $_POST['ftel'],
'remarks' => $_POST['fremarks'],
'wedding_date' => $_POST['fyyyy'].'-'.$_POST['fmm'].'-'.$_POST['fdd'],
'gowns' => $_POST['savedGowns'],
'sent' => 0
));
if (!preg_match('/^[0-9\+]+$/', $this->data['Enquiry']['gowns'])){
$ok = false;
$error = 'Invalid gown list';
}
It keeps telling me that the string is invalid even though it is. The string I output to PHP is absolutely valid COLOR=black[/COLOR]. So I suspect could the string have become encoded when it goes into php or something? Like the “+” chars becomes something else?