Multi Page Forms and Field Values

momentis 07 Oct, 2010
I have a multi page form which contains 5 child pages. On the fourth child page, I have inserted PHP in order to populate two fields with info from the 'users' and 'comprofiler' tables. Specifically, it is retrieving the logged in user's email address and inserting it into the applicable form field, and is pulling the user's mobile number and doing the same.

When I view the individual page (named 'cr_child_reminders') on the front-end, the fields populate normally (see attached image named 'child.jpg'). You can see that the correct email address and phone number are populating. I have included a line just above each box to print the array results from the underlying query as well.

When I view the page in sequence in the mother form (it is page 4 of 5), the fields do not populate with the values (see attached image 'mother.jpg'). Interestingly, you can see that the print of the array above each box does indeed find the correct record, but it is not passing that value into the input box the way it does when running the form page separately.

The code being used for the email field is (for reference purposes):
<?php

$user = JFactory::getUser();
$myid = $user->id;
$db =& JFactory::getDBO();

$query = "SELECT email FROM #__users WHERE id='$myid';";

$db->setQuery($query);

$row = $db->loadRow();

print_r($row);

$exist_email = $row['0'];

echo "<div class='form_item'>";
echo "<div class='form_element cf_textbox'>";
echo "<label class='cf_label' style='width: 150px;'>Email</label>";
echo "<input class='cf_inputbox validate-email' maxlength='150' size='30' title='' id='text_37' name='reminder_emailaddr' type='text' value='$exist_email' />";
echo "</div>";
echo "<div class='cfclear'> </div>";
echo "</div>";

?>


Any idea what I am doing wrong?
GreyHead 07 Oct, 2010
Hi momentis,

I'm not sure without checking the code. I guess that the Plug-in may be re-setting the values from the previously stored data and that this is over-writing the value that you have set.

I'll check the code when I have a few minutes and see if I can spot anything and work out a fix.

Bob
momentis 07 Oct, 2010
Thanks, Bob!!! I have attached here the FULL code for that particular page, just in case that makes a difference.

Peace,
Rick
This topic is locked and no more replies can be posted.