Forums

remove commas and white space in date

carionpiet 23 Nov, 2011
Hi,

I've found this code to display a date in one field.
works fine but it displays "2010, 08, 21"

Is it possible to make it "20100821", so remove the commas and white space?

<select name="date[]" id="year">
        <option>2010</option>
        <option>2011</option>
    </select>
    <select name="date[]" id="month">
        <option>08</option>
        <option>09</option>
    </select>
    <select name="date[]" id="day">
        <option>21</option>
        <option>22</option>
    </select>
<input type="submit">
GreyHead 23 Nov, 2011
Hi carionpiet,

If you edit the Handle Arrays action to remove the comma and space as the separator I think this will work. Otherwise you may need to implode the array using a Custom Code action.

Bob

PS I suggest you change your username so that your email does not appear here.
carionpiet 23 Nov, 2011
When I try something like:
$date = implode('', $_POST['date']);

nothing happens...
GreyHead 24 Nov, 2011
Hi [email]carionpiet@yahoo.com[/email],

Please try
<?php
$form->data['date'] = implode('', $form->data['date']);
?>


Bob
This topic is locked and no more replies can be posted.