I would like to split the field specific location on this page: http://qwikad.com/?view=post&cityid=269&lang=en&catid=3&subcatid=27&shortcutregion= into two fields. I want keep the same MySQL table for that field but make it possible for visitors to enter 2 separate texts: <input name="area" type="text" size="40" class="input" maxlength="50" value="<?php echo $data['area']; ?>"> Can this be done?
sure u can make 2 input fields example: <input name="area1" type="text" size="20" class="input" maxlength="50" value="<?php echo $area1; ?>"> <input name="area2" type="text" size="20" class="input" maxlength="50" value="<?php echo $area2; ?>"> then to be able to save the 1 variable to the database u must join them to the normal sql variable: <?php $data['area'] = $area1.'|'.$area2; ?> to save to database and u can use the explode php function again if u want to split the $data['area'] to 2 variables: <?php $areaz = explode('|',$data['area']); var_dump($areaz); // in var_dump u get the array of the 2 splitted input fields ?> Hope this helps.
It looks easy but I am not sure how it will look in the code. Here's the original code: <?php } else { ?> <input name="area" type="text" size="40" class="input" maxlength="50" value="<?php echo $data['area']; ?>"> <?php } ?> Will it then look like this?: <?php } else { ?> <input name="area1" type="text" size="20" class="input" maxlength="50" value="<?php echo $area1; ?>"> <input name="area2" type="text" size="20" class="input" maxlength="50" value="<?php echo $area2; ?>"> <?php $data['area'] = $area1.'|'.$area2; ?> <?php $areaz = explode('|',$data['area']); var_dump($areaz); ?> <?php } ?> Does it look right? Thank you for the help.
Actually, after trying it a few times I don't think it's working. Maybe you can suggest something else?