Forums

Linking form info

rowberry 22 Nov, 2010
Hi all
Hopefully someone can help me asap please!
I think I am getting on quite well with chronoforms, seems pretty straightforward! I have managed to create a registration page and it all works๐Ÿ™‚
The trouble is, I want to link the information from my registration page (name, email, car make & model) to a booking form for users to book their car in.
I have created the booking form but have no idea how to pull the information from the registration details so that the fields are already populated on the booking form.

At a guess, I enabled the profile plugin for the booking form but dont know what to put in the 'Request' parameter name box. I think this is probably where i've gone wrong?

I need basic laymans terms please! ๐Ÿ˜›

many thanks in advance

PS I have just noticed that i need to use connectivity to link more than one field, I have installed it but I am even more lost! Could somebody please help me to link fields from my register page to my booking form?
Thank you
GreyHead 22 Nov, 2010
Hi rowberry,

If you search here on 'getuser' you will find many examples of getting the user registration info and using it.

Bob
rowberry 22 Nov, 2010
Thanks for your quick reply Bob.
I've had a look through as you suggested but I'm sorry, I still dont understand.
Its getting late so I'll give it a break for tonight and try again in the morning,
rowberry 23 Nov, 2010
Hi again
I'm sorry, I still dont understand!

I'm getting to the point where I will be too frustrated to use it and I feel like I should understand but dont!๐Ÿ˜ถ

I have a working registration form, sends emails and everything!๐Ÿ™‚ The frustrating bit that I cannot do is get data from my database into my booking form. For example, name, address, email, Car make and model, ๐Ÿ˜Ÿ

Please could you help me in very simple terms?
rowberry 23 Nov, 2010
I'm guessing that I need to put some code in the 'form code' bit to tell it where to link to?

This is taken from my form code:

<div class="form_item">
<div class="form_element cf_textbox">
<label class="cf_label" style="width: 150px;">Vehicle Registration</label>
<input class="cf_inputbox required" maxlength="150" size="30" title="" id="text_2" name="text_2" type="text" />


What do i add to tell it to populate it with information that was entered at registration?
GreyHead 24 Nov, 2010
Hi rowberry,

The Joomla! user information is available from the Joomla! User Object
<?php
$user =& JFactory::getUser();
?>
. . .
<input type='text' name='user_name' id='user_name' value='<?php echo $user->name; ?>' />

Information you have saved in another table is accessible through a MySQL query
<?php
$db =& JFactory::getDBO();
$query = "
    SELECT `vehicle_registration`, `vehicle_make`
        FROM `#__some table`
        WHERE `cf_user_id` = '".$user->id."' ;
";
$db->setQuery($query);
$data = $db->loadObject();
?>
. . .
<input type='text' name='vehicle_registration' id='vehicle_registration' value='<?php echo $data->vehicle_registration; ?>' />
<input type='text' name='vehicle_make' id='vehicle_make' value='<?php echo $data->vehicle_make; ?>' />
Your table and column names will of course be different.

If you only need to show the data then you can use e.g.
<?php echo $data->vehicle_make; ?>


If you need to make the code editable then you will need to do more work to make sure that values are correctly re-saved.

Bob
rowberry 24 Nov, 2010
Thank you so much. Will give it a go now๐Ÿ™‚
This topic is locked and no more replies can be posted.