Hello, I have taken the data of a table in a dropdown box with the following script in select field, but I can´t save into the data base. After submitting the form all the cf_id, recordtime...data is saved on db; but the select info retrieved with loadObjectList, no.
Can anybody tell me how to save this kind of data?
Thanks in advance
Can anybody tell me how to save this kind of data?
Thanks in advance
<div class="form_item">
<div class="form_element cf_dropdown">
<label class="cf_label" style="width: 150px;">Click Me to Edit</label>
<select class="cf_inputbox" id="select_2" size="1" title="" name="select_2">
<option value="">Elija</option>
<?php
$db =& JFactory::getDBO();
$query = "
SELECT *
FROM #__chronoforms_ingresodeproveedor";
$db->setQuery($query);
$rows = $db->loadObjectList();
foreach ($rows as $row) {
echo "<option value='$row->id'>$row->catalogo</option>";
}
?>
</select>
</div>
<div class="cfclear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_button">
<input value="Enviar" name="button_1" type="submit" />
</div>
<div class="cfclear"> </div>
</div>
Hi fabaya,
Please use PHP MyAdmin to check (a) do the columns exist in the table (if not then they probably weren't selected in the Create Table dialogue); (b) is there data in the columns?
For more info please check the Database tutorial from the Tutorials link above, or Chapter 4 in the ChronoForms Book.
Bob
Please use PHP MyAdmin to check (a) do the columns exist in the table (if not then they probably weren't selected in the Create Table dialogue); (b) is there data in the columns?
For more info please check the Database tutorial from the Tutorials link above, or Chapter 4 in the ChronoForms Book.
Bob
Bob: thanks again. Before anything: I kept my promise and I was reading the tutorial on databases before posting. I confirm that the column exists in the database, the database was created with "create table" chronoform, the field are now x (added) and any other field other than dropdown with this function write the DB. Additionally, checking with debug: I note that the values are not passed. I think that retrieve the value of a field using this method may have to do with this non write in data base error.
Hi fabaya,
Thank you.
Now please turn Debug on in the form General tab and post here the debug info you get when you submit the form.
Bob
Thank you.
Now please turn Debug on in the form General tab and post here the debug info you get when you submit the form.
Bob
Form passed first SPAM check OK
Form passed the submissions limit (if enabled) OK
Form passed the Image verification (if enabled) OK
Form passed the server side validation (if enabled) OK
$_POST Array: Array ( [select_2] => [button_1] => Enviar [79e6c97c0315ed93c5922cab62f12436] => 1 [1cf1] => 4847004685cd05eb51fdf3ff61ace4f1 [chronoformname] => are )
$_FILES Array: Array ( )
Form passed the plugins step (if enabled) OK
Debug End
Hi fabaya,
[select_2] => has no value so the record is saving correctly.
What is the Form HTML for the select box please?
Bob
[select_2] => has no value so the record is saving correctly.
What is the Form HTML for the select box please?
Bob
Html form? The same of above, I think
Thanks
Thanks
<div class="form_item">
<div class="form_element cf_dropdown">
<label class="cf_label" style="width: 150px;">Click Me to Edit</label>
<select class="cf_inputbox" id="select_2" size="1" title="" name="select_2">
<option value="">Elija</option>
<?php
$db =& JFactory::getDBO();
$query = "
SELECT *
FROM #__chronoforms_ingresodeproveedor";
$db->setQuery($query);
$rows = $db->loadObjectList();
foreach ($rows as $row) {
echo "<option value='$row->id'>$row->catalogo</option>";
}
?>
</select>
</div>
<div class="cfclear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_button">
<input value="Enviar" name="button_1" type="submit" />
</div>
<div class="cfclear"> </div>
</div>
Hi fabaya,
Apologies, I didn't check back far enough - and I should have asked for the form source code from the browser anyhow. I think you may be missing some quotes in this line
Bob
Apologies, I didn't check back far enough - and I should have asked for the form source code from the browser anyhow. I think you may be missing some quotes in this line
echo "<option value='".$row->id."'>".$row->catalogo."</option>";Bob
Hi, Bob: I made the change, but nothing happens. Plus this is the code of the browser page:
Thanks
<div class="art-PostContent">
<form name="ChronoContact_asert" id="ChronoContact_asert" method="post" action="http://localhost/acceso/index.php?option=com_chronocontact&task=send&chronoformname=asert" >
<div class="form_item">
<div class="form_element cf_dropdown">
<label class="cf_label" style="width: 150px;">Click Me to Edit</label>
<select class="cf_inputbox" id="" size="1" title="" name="select_2">
<option value="">Elija</option>
<br />
<b>Notice</b>: Undefined property: stdClass::$id in <b>C:\wamp\www\acceso\components\com_chronocontact\chronocontact.html.php(180) : eval()'d code</b> on line <b>14</b><br />
<option value=''>Internet fija</option> </select>
</div>
<div class="cfclear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_button">
<input value="Enviar" name="button_1" type="submit" />
</div>
<div class="cfclear"> </div>
</div> <input type="hidden" name="9df6630f7bb3156075ecccfd2e02e890" value="1" />
<input type="hidden" name="1cf1" value="ee840f39ca0a72709d96f35b828ead9c" />
</form>
Thanks
Bob as I promise: Im getting better with this chronostuff....
The correct sintaxis -just in case somebody needs it- is:
Bob, again: thanks for your support and knowledge. You are a gentleman...
I dont know why but repeating the $row calling works!
The correct sintaxis -just in case somebody needs it- is:
echo "<option value='".$row->catalogo."'>".$row->catalogo."</option>";Bob, again: thanks for your support and knowledge. You are a gentleman...
I dont know why but repeating the $row calling works!
Hi fabaya,
The first one is the 'value' that is returned when the form is submitted; the second is the text that is displayed in the drop-down. Here they are the same but they don't need to be - for example, for a list of US states you might use the two letter code MI in the value and the name Michigan in the display text.
Bob
The first one is the 'value' that is returned when the form is submitted; the second is the text that is displayed in the drop-down. Here they are the same but they don't need to be - for example, for a list of US states you might use the two letter code MI in the value and the name Michigan in the display text.
Bob
This topic is locked and no more replies can be posted.
