type "select" not added in the table whe

marcelke 13 Feb, 2008
Hello,

In my form I use a select field , see here

When the form was made I selected all the field to create a table. They are all being added accept the selcet field. It is also not in the AutoGenerated code see below.

Anything I am doing wrong? For instance used the wrong column type?
<?php 
	$database =& JFactory::getDBO();
	
$database->setQuery( "INSERT INTO #__chronoforms_3 VALUES  (
'' , '". date('Y-m-d')." - ".date("H:i:«»s"«»)."', '".$_SERVER['REMOTE_ADDR']."' , '".$_POST['Naam']."' , '".$_POST['Adres']."' , '".$_POST['Woonplaats']."' , '".$_POST['Postcode']."' , '".$_POST['Telefoon']."' , '".$_POST['Email']."' , '".$_POST['Kortingscode']."' , '".$_POST['factuur']."' , '".$_POST['algemenevoorwaarden']."' , '".$_POST['Verzenden']."' , '".$_POST['Wissen']."');" );
if (!$database->query()) {
echo "<script> alert('".$database->getErrorMsg()."'); window.history.go(-1); </script>
";
}
?>
<br><br>Post edited by: GreyHead, at: 2008/02/13 01:14
marcelke 13 Feb, 2008
Forgot to mention: I am using a HTML Form code
Max_admin 13 Feb, 2008
Hi MArcel,

I cant open your site but if the select wasn't in the list of fields when you was creating a table then the select doesn't have a good name in the HTML

Please put your form HTML here and I will look

Cheers,

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
GreyHead 13 Feb, 2008
Hi Marcel,

You have spaces in the field name. This is invalid html (even though it may work) and ChronoForms can't parse it properly
<select id="Ik geef me op voor de workshop" name="Ik geef me op voor de workshop">
Replace the spaces with underlines, or better, use a shorter name.

Bob<br><br>Post edited by: GreyHead, at: 2008/02/13 01:16
marcelke 13 Feb, 2008
Hello Bob an Max,

I deleted the spaces and replaced them by _ . It worked just fine.

I a releative newby and did just what was said on your website. I have copied the code from the form of my other site, made in Dreamwaever, and pasted it in ChronoForms.

Maybe an idea to ad this in the tooltip in chronform of a manual?

Thanks for quick resonce and your support.

Marcel
GreyHead 13 Feb, 2008
Hi Marcel,

Good, glad it worked.

I've made a note to add it in the documentation somewhere - just not sure where, there are so many little things to look out for.

Bob

PS I'm surprised that Dreamweaver allowed it. I went back to check the HTML4 docs and they say: "ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods (".")." (no spaces though!)
sailsmart 22 Apr, 2008
I'm doing a dropdown menu from dreamweaver and need help with my code. I need to have a detailed enough explanation in the return email feed to state what session was chose, and price. Also how to export it into excel.
<td width="32%"><strong><font color="#FF0000">Optimist Learn to Sail </font></strong>
<select name="menu1" onchange="MM_jumpMenu('parent',this,0)">
<option selected="selected">Select a choice...</option>
<option>Optimist Learn to Sail-Session 1- June 30-July 4-$204.75</option>
<option>Session 2: July 7-11-$204.75</option>
<option>Session 3: July 14-18-$204.75</option>
<option>Session 4: July 21-25-$204.75</option>
<option>Session 5: July 28-Aug. 1-$204.75</option>
<option>Session 6: Aug.5-8**-$163.10</option>
<option>Session 7: Aug 11-15-$204.75</option>
<option>Session 8: Aug18-22-$204.75</option>
<option>Optimist Race Team- Session 1June 30-July 25$761.25</option>
<option>Optimist Race Team- Session 2-July 28-Aug 22-$761.25</option>
</select>
</td>
GreyHead 22 Apr, 2008
Hi sailsmart,

First off I'd suggest that you use a block of radio buttons for a selection this complex - it's harder to choose from a drop-down box.

For the drop-down option I tend to prefer to use arrays as it make the code cleaner and easier to manage.
<select name="menu1" >
<option selected="selected">Select a choice...</option>
<?php 
$options_array = array(
  's1' => "Optimist Learn to Sail-Session 1- June 30-July 4-$204.75",
  's2' => "Session 2: July 7-11-$204.75",);
  . . .
  's10' => "Optimist Race Team- Session 2-July 28-Aug 22-$761.25",);
foreach ( $option_array as $s => $title ) {
  echo "<option value = '$s'>$title</option>";
}
?>
</select>
This will return you an entry like $_POST['menu1'] = s4. If you want you can then decode it in the OnSubmit before email box and save it as you like.

To decode just look up the returned value in the array. But you might want to split it up into more useful chunks like session, date & price.

I'm not quite sure what you want in Excel but if you save the results in the database you can export them from the Form Manager.

Bob
This topic is locked and no more replies can be posted.

VPS & Email Hosting 20% discount
hostinger