Topic: $form in profile.php
Hmmm, seems I lack some knowledge in php.
I'm trying to split the name field in the profile update view:
...
<legend><?php echo $lang_profile['Personal details legend'] ?></legend>
<div class="infldset">
<input type="hidden" name="form_sent" value="1" />
<label class="conl"><?php echo $lang_common['First name'] ?><br /><input type="text" name="form[first_name]" value="<?php echo pun_htmlspecialchars(substr($user['realname'],0,strpos($user['realname'],' '))) ?>" size="25" maxlength="25" /><br /></label> <!--realname mod -->
<label class="conl"><?php echo $lang_common['Last name'] ?><br /><input type="text" name="form[last_name]" value="<?php echo pun_htmlspecialchars(substr($user['realname'],strpos($user['realname'],' ')+1,strlen($user['realname']))) ?>" size="25" maxlength="25" /><br /></label> <!--realname mod -->
<p class="clearb"></p> <!--realname mod-->
<?php if (isset($title_field)): ?> <?php echo $title_field ?>
<?php endif; ?> <label><?php echo $lang_profile['Location'] ?><br /><input type="text" name="form[location]" value="<?php echo pun_htmlspecialchars($user['location']) ?>" size="30" maxlength="30" /><br /></label>
<label><?php echo $lang_profile['Website'] ?><br /><input type="text" name="form[url]" value="<?php echo pun_htmlspecialchars($user['url']) ?>" size="50" maxlength="80" /><br /></label>
</div>
...
This works fine alright.
So i look for all occurances of the field 'realname' in profile.php, but only finds one other place it's used (other than in the preview mode) and this is here:
case 'personal':
{
$form = extract_elements(array('realname', 'url', 'location'));
now, this is weird. Shouldn't $form do some updating on the database or something??
I tried to add the fields 'first_name' and 'last_name' in the stead of 'realname' in the extract_elements params, but that didn't work.
I'd like to find a way to join the first_name and last_name fields into realname and put them into the database field that corresponds to $user['realname'].
Like this:
$form['realname'] = pun_trim($form['first_name'])." ".pun_trim($form['last_name']);
But that just won't work. (I feel like an idiot).
Is there a way to achieve what I want?
However, many were excited and some may have enjoyed the experience.