Hi
I have a custom code in the On Load, which does a query of a database and then builds a drop down box.
Question, is how do I add that select drop down box to the form->data so I can use the value selected in the drop down box in the next form?
The select box is input_select_4 it creates this drop down just fine, but it does not appear to be part of the form->data per the debug element. I do a redirect user to this same page, so as they select an item, I query the database again and bring back another set of values... except this is not working. It only brings back the first set of values.
Here is my custom code
I have a custom code in the On Load, which does a query of a database and then builds a drop down box.
Question, is how do I add that select drop down box to the form->data so I can use the value selected in the drop down box in the next form?
The select box is input_select_4 it creates this drop down just fine, but it does not appear to be part of the form->data per the debug element. I do a redirect user to this same page, so as they select an item, I query the database again and bring back another set of values... except this is not working. It only brings back the first set of values.
Here is my custom code
<?php
// localhost
$dbhostname='localhost:8889';
$dbusername='root';
$dbpassword='root';
$dbname='cfps';
$con = mysql_connect($dbhostname,$dbusername,$dbpassword);
mysql_select_db($dbname, $con);
$inValue = $form->data['input_select_4'];
$sql = 'select parent_id, btn_txt, image_file, page_text from sa_content where parent_id = '.$inValue;
$result = mysql_query($sql) or die(mysql_error());
$row = mysql_fetch_array($result);
if($row['btn_txt'] == '' && $row['image_file'] = '')
{
// print out page text
$pgtext = $row['page_text'];
echo "<h2>$pgtext</h2>";
}
else if($row['btn_txt'] == '' && $row['page_text'] = '')
{
// show the image
$imageFile = $row['image_file'];
echo "<img src='/images/$imageFile'";
}
else
{
// show select box input_select_4
$result1 = mysql_query($sql) or die(mysql_error());
echo "<select name='input_select_4'>";
while($row1 = mysql_fetch_array($result1))
{
$prnt_id = $row1['parent_id'];
$btntxt = $row1['btn_txt'];
echo "<option value='$prnt_id'>$btntxt</option>";
}
echo "</select>";
}
?>