Buy Now
Sign in

Link in display of a DB

Irate , January 10 2016
I
Irate

Hi Bob
My project is progressing slowly, still thank you to Max. Now I shall post the information stored in my database, but I would like to select and view one item by clicking on a link. An example is easier to understand::

http://lamap44.ac-nantes.fr/index.php?option=com_chronoforms5&chronoform=affichemateriel
I tried with

, but I can not find how to provide the correct address. My code in custom code.
				<table WIDTH=100% height=140px>
<TR><TH><h4>Image</h4></TH><TH><h4>Titre</h4></TH><TH><h4>Description</h4></TH><TH><h4>Disponibilité</h4></TH><TH><h4>Emprunter</h4></TH></TR>
<?php
foreach ($form->data['data'] as $materiel):
?>
<tr bgcolor="#FFFFFF">
<td><img src="components/com_chronoforms5/chronoforms/uploads/newmateriel/<?php echo $materiel['Image']; ?>" width="50" height="50" alt="" title="" /></td>
<td><?php echo $materiel['titre'];?></td>
<td><?php echo $materiel['description'];?></td>
<td></td>
<td><?php echo "<a href='{$form->data['data']['id']}' > Emprunter</a>" ?></td>
</tr>
<?php
endforeach;
?>
</table>


Can you help me ?



Regards

Bruno

GreyHead

Hi Bruno,

That would work OK if $form->data['data']['id'] contains the URL you want to open but I guess that it is just the id so it needs to be more like this

				<td>
<?php
$form_link = JURI::root().'index.php?option=com_chronoforms5&chronoform=my_form_name&id='.$form->data['data']['id'];
echo "<a href='{$form_link}' >Emprunter</a>"
?>
</td>

Bob

ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much

I
Irate

Hi Bob,

First, take the time to drink coffee is hot ...

I placed the code that you sent me, I changed my_form_name by affichemateriel (the name of the file already open), but I have an answer:

Form name can NOT be empty!


I checked the code when I fly over the link. The number of the ID does not appear. I modified the code
				$form->data['data']['id']
				
par
				$materiel['id']
				

. Now I see the id fly over the link but...

Form name can NOT be empty!



Bruno

I
Irate

Oups ,
I made a mistake by copying the code ...
I corrected and I do not get the message but I do not have detail
http://lamap44.ac-nantes.fr/index.php?option=com_chronoforms5&chronoform=affichemateriel&id=3
Code:

				<table WIDTH=100% height=140px>
<TR><TH><h4>Image</h4></TH><TH><h4>Titre</h4></TH><TH><h4>Description</h4></TH><TH><h4>Disponibilité</h4></TH><TH><h4>Emprunter</h4></TH></TR>
<?php
foreach ($form->data['data'] as $materiel):
?>
<tr bgcolor="#FFFFFF">
<td><img src="components/com_chronoforms5/chronoforms/uploads/newmateriel/<?php echo $materiel['Image']; ?>" width="50" height="50" alt="" title="" /></td>
<td><?php echo $materiel['titre'];?></td>
<td><?php echo $materiel['description'];?></td>
<td></td>
<td>
<?php
$form_link = JURI::root().'index.php?option=com_chronoforms5&chronoform=affichemateriel&id='.$materiel['id'];
echo "<a href='{$form_link}' >Emprunter</a>"
?>
</td>
</tr>
<?php
endforeach;
?>
</table>


Bruno

GreyHead

Hi Bruno,

You have used a relative SEF URL while I deliberately used a non-SEF absolute one. Please try with my example.

Bob

ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much

I
Irate

Hi Bob,

I try your example.

				<table WIDTH=100% height=140px>
<TR><TH><h4>Image</h4></TH><TH><h4>Titre</h4></TH><TH><h4>Description</h4></TH><TH><h4>Disponibilité</h4></TH><TH><h4>Emprunter</h4></TH></TR>
<?php
foreach ($form->data['data'] as $materiel):
?>
<tr bgcolor="#FFFFFF">
<td><img src="components/com_chronoforms5/chronoforms/uploads/newmateriel/<?php echo $materiel['Image']; ?>" width="50" height="50" alt="" title="" /></td>
<td><?php echo $materiel['titre'];?></td>
<td><?php echo $materiel['description'];?></td>
<td></td>
<td>
<?php
$form_link = JURI::root().'index.php?option=com_chronoforms5&chronoform=my_form_name&id='.$form->data['data']['id'];
echo "<a href='{$form_link}' >Emprunter</a>"
?>
</td>
</tr>
<?php
endforeach;
?>
</table>


But... Form not found or is not published

example :
http://lamap44.ac-nantes.fr/index.php?option=com_chronoforms5&chronoform=affichemateriel

Bruno

GreyHead

Hi Bruno,

Please replace 'my_form_name' with the name of your form.

Bob

ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much

I
Irate

Hi Bob,
I did,but it did not work.
Bruno

GreyHead

Hi Bruno,

I'm not sure what you are trying to do here. The link is working OK but just reloads the same page. What form do you want to use to edit the record?

Bob

ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much

I
Irate

Hi Bob,

Sorry, but first i was working outside and second I was sick...
I have created an other file but i dont know how to recuperate the informations with the 'id'.
In Data Array, i have

				Array
(
[option] => com_chronoforms5
[chronoform] => fichemprun
[id] => 3
[Itemid] =>
[Data4] => Array
(
[id] => 3
[uniq_id] => 58ddf303b72d6ff8456309992aed56a48136f087
[user_id] => 0
[created] => 2016-01-10 16:52:53
[modified] =>
[titre] => Ombre et lumière
[Image] => 20160110165253_ombre.jpg
[description] => Mallette pour travailler ombre et lumière. Boules polystyrène, lampes, divers objets...
)

)


How to display my data?

GreyHead

Hi Bruno,

Please tell me how you want to display it???

Bob

ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much

I
Irate

Hi Bob,


I want to display it in a table and add a field to confirm the loan. Then I want to save into a new table;

Bruno

GreyHead

Hi Bruno,

You can use a Custom Code element (or a Custom Code action) to display the data in a table.

I'm still not clear where this is to be displayed.

Bob

ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much