Hi,
I have a doubt and I do not know how to do it.
I have a form working very well without any problem. in this form there is a dropdown where you choose an specific accommodation.
In other side we have joomla content with every accommodation and there is button (book) which send every accommodation to the form.
We would like when the client click on book button from specific accommodation, send to the form and this accommodation be selected from the dropdown.
could you give any clue how to do it? How to pass the field from content and be received by the form.
Thanks very much,
Daniel
I have a doubt and I do not know how to do it.
I have a form working very well without any problem. in this form there is a dropdown where you choose an specific accommodation.
In other side we have joomla content with every accommodation and there is button (book) which send every accommodation to the form.
We would like when the client click on book button from specific accommodation, send to the form and this accommodation be selected from the dropdown.
could you give any clue how to do it? How to pass the field from content and be received by the form.
Thanks very much,
Daniel
Hi epsdaniel,
You must have some kind of id for the accommodation -like 'acc01', 'acc02', . . .
Make the Book button on the content page pass the accommodation id with a hidden field.
Bob
You must have some kind of id for the accommodation -like 'acc01', 'acc02', . . .
Make the Book button on the content page pass the accommodation id with a hidden field.
<input type="hidden" name="acc_id" value="acc02" />
Then you can use something like this in the form html to set that accommodation as selected:
<select . . . >
<?php
$acc_array = array('acc01' => 'Accommodation 1', 'acc02' => 'Accommodation 2', . . .);
foreach ( $acc_array as $k =>$v ) {
if ($_POST['acc_id'] == $k ) {
$selected = "selected='selected'";
} else {
$selected = "";
}
echo "<option value="$k" $selected>$v</option>;
}
?>
</select>
Bob
Hi bob
Thanks for your reply. I make something wrong because I can not make work
I did the button as you told me in content page
In form code (form html) I put the code as down.
I receive an error: Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';' in /home/ceqfvkgl/public_html/components/com_chronocontact/chronocontact.html.php(83) : eval()'d code on line 11
In line 11 y tried differente ways and all wrong. I am sorry to ask such this things but I have no idea to make it work (I know is php matter).
I really aprechiate you help.
Dani
Thanks for your reply. I make something wrong because I can not make work
I did the button as you told me in content page
In form code (form html) I put the code as down.
I receive an error: Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';' in /home/ceqfvkgl/public_html/components/com_chronocontact/chronocontact.html.php(83) : eval()'d code on line 11
In line 11 y tried differente ways and all wrong. I am sorry to ask such this things but I have no idea to make it work (I know is php matter).
I really aprechiate you help.
Dani
<select name="acc_id">
<?php
$acc_array = array('acc02' => 'Accommodation 2');
foreach ( $acc_array as $k =>$v ) {
if ($_POST['acc_id'] == $k ) {
$selected = "selected='selected'";
} else {
$selected = "";
}
echo "<option value="$k" $selected>$v</option>;
}
?>
<option>Ninguno</option>
<option value="acc02" id="acc02">Accommodation 2</option>
</select>
Hi espdaniel,
My mistake -looking at line 11 in the code I got my quotes in a mess. Try this version
Bob
My mistake -looking at line 11 in the code I got my quotes in a mess. Try this version
echo "<option value='$k' $selected>$v</option>";
Bob
Hi Bob,
Back again from holidays 😀
I have a new question regarding this post. Now I want to introduce a change just to test how customer behave.
Now I want to attach the reservation form in every accommodation content page. So I made tabs and in one of the tab I load the form.
My problems is that to avoid to make one different form for every accommodation I want to keep one form with the funtion of pre-select of the accommodation. I want to load an accommodation page and then the form pre-select the accommodation we are.
Last I click the button in content page and it redirected to reservation page with the accommodation pre-selected. Now I want to be in the content and the accommodation load already selected.
I tried to introduce at the top of the content page <input name="acc_id" value="barcelo-gata" type="hidden"> but not works.
Do you have any recomendation? If you would visit my test page I leave you the link http://www.soleranet.com/balnearios-andalucia/balnearios-almeria/hotel-spa-barcelo-cabo-de-gata.html
Thanks very much in advance.
Regards,
Daniel
Back again from holidays 😀
I have a new question regarding this post. Now I want to introduce a change just to test how customer behave.
Now I want to attach the reservation form in every accommodation content page. So I made tabs and in one of the tab I load the form.
My problems is that to avoid to make one different form for every accommodation I want to keep one form with the funtion of pre-select of the accommodation. I want to load an accommodation page and then the form pre-select the accommodation we are.
Last I click the button in content page and it redirected to reservation page with the accommodation pre-selected. Now I want to be in the content and the accommodation load already selected.
I tried to introduce at the top of the content page <input name="acc_id" value="barcelo-gata" type="hidden"> but not works.
Do you have any recomendation? If you would visit my test page I leave you the link http://www.soleranet.com/balnearios-andalucia/balnearios-almeria/hotel-spa-barcelo-cabo-de-gata.html
Thanks very much in advance.
Regards,
Daniel
Hello again.
I been playing and searching othe solution into foro about the matter I have. I have found post talking about get the Page title and input into email subject. That´s solution is great for me!
But I have the problem that I need the article title istead of page title which correspond to category title (or itemid title). I read is itemid problem (to be deleted from the url) but I use differents templates plus smartsef I can´t do it (or I do not know how to do it)
I need any way to identify the article where the form is sent. I do not mind url, article title, meta data (I have seo patch so I control metas in articles) or whatever makes me identify from which article the form is submitted.
I really aprechiatte help in this problem.
thanks
Dani
I been playing and searching othe solution into foro about the matter I have. I have found post talking about get the Page title and input into email subject. That´s solution is great for me!
But I have the problem that I need the article title istead of page title which correspond to category title (or itemid title). I read is itemid problem (to be deleted from the url) but I use differents templates plus smartsef I can´t do it (or I do not know how to do it)
I need any way to identify the article where the form is sent. I do not mind url, article title, meta data (I have seo patch so I control metas in articles) or whatever makes me identify from which article the form is submitted.
I really aprechiatte help in this problem.
thanks
Dani
Hi Dani,
you may try :
you may try :
$document =& JFactory::getDocument();
echo $document->getTitle();
This topic is locked and no more replies can be posted.