God morning Bob,
I have been reading some posts about data retrieval using chronoforms, and followed the instructions, but i'm missing something.
I have a pets site, and i have an area called Blood Bank. I want people to register theirs pets, as blood-donors. This way, whenever a pet needs surgery and a blood transfusion, the owner, can come to my site and look for donors in their region.
STEP 1
So, i have a form to collect inscriptions from blood-donors.
I called this form, bancodesangue_collect and put it inside a content item (http://cp03.buyhttp.com/~insidepd/index.php?option=com_content&task=view&id=391&Itemid=104)
In the form i inserted this code in html form:
(read only i temporarily disabled for test purposes)
I tested through mail and everything is ok. Validation is working also.
STEP 2
In the same form (bancodesangue_collect) is have created a table. Filled the form again and send it so at the moment i have one record in my table.
STEP 3
I edited the form and checked the autogenerated code:
STEP 4
I have created a second form, called bancodesangue_display and put it inside a content item (http://cp03.buyhttp.com/~insidepd/index.php?option=com_content&task=view&id=447&Itemid=104)
STEP 5
I went to Profile page for bancodesangue_display form, and filled this way:
I believe this is where i have the mistake, because, i don't really understand REQUEST Parameter name.
STEP 6
Last, i went to the form bancodesangue_display, and typed in html for the following code:
I'm not sure of this step too. I'm not sure if this piece of code should be in html form or other place ...
Anti-spam and validation are set to no on this form.
When i check the content item that as bancodesangue_display, i received this error message:
Can you help me?
I have been reading some posts about data retrieval using chronoforms, and followed the instructions, but i'm missing something.
I have a pets site, and i have an area called Blood Bank. I want people to register theirs pets, as blood-donors. This way, whenever a pet needs surgery and a blood transfusion, the owner, can come to my site and look for donors in their region.
STEP 1
So, i have a form to collect inscriptions from blood-donors.
I called this form, bancodesangue_collect and put it inside a content item (http://cp03.buyhttp.com/~insidepd/index.php?option=com_content&task=view&id=391&Itemid=104)
In the form i inserted this code in html form:
(read only i temporarily disabled for test purposes)
<?php
global $my,$mosConfig_live_site;
// verifica se o utilizador fez login
// o nome e email são preenchidos automáticamente e definidos como read only
//$readonl="";
if ($my->id) {
//$readonl=" readonly='readonly'";
}
?>
<table cellspacing="5">
<tr><td colspan="2" valign="top"><h1>Dados do animal</h1></td></tr>
<tr><td valign="middle"><label for="nomeanimal">Nome</label></td>
<td valign="middle"><input name="nomeanimal" type="text" id="nomeanimal" /></td></tr>
<tr><td valign="middle"><label for="especie">Espécie</label></td>
<td valign="middle"><select name="especie" size="1" id="especie">
<option selected>Cães</option>
<option>Gatos</option>
</select></td></tr>
<tr><td valign="middle"><label for="raca">Raça</label></td>
<td valign="middle"><input name="raca" type="text" id="raca" value="Raça não definida" /></td></tr>
<tr><td valign="middle"><label for="idade">Idade</label></td>
<td valign="middle"><input name="idade" type="text" id="idade" size="5" /> anos</td></tr>
<tr><td valign="middle"><label for="peso">Peso</label></td>
<td valign="middle"><input name="peso" type="text" id="peso" size="5" /> kg</td></tr>
<tr><td valign="middle"><label for="altura">Altura</label></td>
<td valign="middle"><input name="altura" type="text" id="altura" size="5" /> cm</td></tr>
<tr><td colspan="2" valign="top"> </td></tr>
<tr><td colspan="2" valign="middle"><h1>Reside com ...</h1></td></tr>
<tr><td valign="middle"><label for="user">Nome</label></td>
<td valign="middle"><input name="user" type="text" id="user" value="<?php echo $my->name?>"<?php echo $readonl?> /></td></tr>
<tr><td valign="middle"><label for="email">Email</label></td>
<td valign="middle"><input name="email" type="text" id="email" value="<?php echo $my->email?>"<?php echo $readonl?> /></td></tr>
<tr><td valign="middle"><label for="telefone">Telefone</label></td>
<td valign="middle"><input name="telefone" type="text" id="telefone" /></td></tr>
<tr><td valign="top"><label for="distrito">Distrito</label></td>
<td valign="top"><select name="distrito" size="1" id="distrito">
<option>Aveiro</option>
<option>Beja</option>
<option>Braga</option>
<option>Bragança</option>
<option>Castelo Branco</option>
<option>Coimbra</option>
<option>Évora</option>
<option>Faro</option>
<option>Guarda</option>
<option>Leiria</option>
<option selected>Lisboa</option>
<option>Portalegre</option>
<option>Porto</option>
<option>Santarém</option>
<option>Setúbal</option>
<option>Viana do Castelo</option>
<option>Viseu</option>
<option>Açores</option>
<option>Madeira</option></select></td></tr>
<tr><td colspan="2" valign="top"> </td></tr>
<tr><td valign="middle"><label for="data">Data</label></td>
<td valign="middle"><input name="data" type="text" id="data" value="<?php echo(gmstrftime("%d/%m/%Y"«»)); ?>" /></td></tr>
<tr><td valign="middle"> </td>
<td valign="middle"><input type="submit" value="Enviar" class="button"> <input type="reset" value="Limpar" class="button" /></td></tr>
</table>
I tested through mail and everything is ok. Validation is working also.
STEP 2
In the same form (bancodesangue_collect) is have created a table. Filled the form again and send it so at the moment i have one record in my table.
STEP 3
I edited the form and checked the autogenerated code:
<?php
global $database;
$database->setQuery( "INSERT INTO #__chronoforms_2 VALUES (
'' , '". date('Y-m-d')." - ".date("H:i:«»s"«»)."', '".$_SERVER['REMOTE_ADDR']."' , '".mosGetParam($_POST,'nomeanimal','')."' , '".mosGetParam($_POST,'especie','')."' , '".mosGetParam($_POST,'raca','')."' , '".mosGetParam($_POST,'idade','')."' , '".mosGetParam($_POST,'peso','')."' , '".mosGetParam($_POST,'altura','')."' , '".mosGetParam($_POST,'user','')."' , '".mosGetParam($_POST,'email','')."' , '".mosGetParam($_POST,'telefone','')."' , '".mosGetParam($_POST,'distrito','')."' , '".mosGetParam($_POST,'data','')."');" );
if (!$database->query()) {
echo "<script> alert('".$database->getErrorMsg()."'); window.history.go(-1); </script>
";
}
?>
STEP 4
I have created a second form, called bancodesangue_display and put it inside a content item (http://cp03.buyhttp.com/~insidepd/index.php?option=com_content&task=view&id=447&Itemid=104)
STEP 5
I went to Profile page for bancodesangue_display form, and filled this way:
Table: chosed "jos_chronoforms_2" from the list
REQUEST Parameter name: typed "bancodesangue_id"
Target field name: typed "cf_id"
I believe this is where i have the mistake, because, i don't really understand REQUEST Parameter name.
STEP 6
Last, i went to the form bancodesangue_display, and typed in html for the following code:
<?php
// initialise the database code
global $database;
$sql = "SELECT * FROM #__chronoforms_2;";
$database->setQuery($sql);
$rows = $database->loadObjectList();
echo "<table><tr>
<td>Dadores</td></tr>";
foreach ( $rows as $record ) {
echo "<tr>
<td>".$nomeanimal."<br />
".$especie."<br />
".$raca."<br />
".$idade."<br />
".$peso."<br />
".$altura."<br />
".$user."<br />
".$email."<br />
".$telefone."<br />
".$distrito."<br />
".$data."</td>
</tr>";
}
echo "</table>";
?>
I'm not sure of this step too. I'm not sure if this piece of code should be in html form or other place ...
Anti-spam and validation are set to no on this form.
When i check the content item that as bancodesangue_display, i received this error message:
Fatal error: main() [function.require]: Failed opening required '' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/insidepd/public_html/components/com_chronocontact/plugins/cf_profile.php on line 4
Can you help me?