here is my html code

rusty 16 Mar, 2007

<table width="100%" height="365" cellspacing="0" cellpadding="0" border="0">
<tr>
	<td rowspan="13" width="265"> </td>
	<td height="93"> </td>
	<td rowspan="13" width="240"> </td>
</tr>
<tr>
	<td align="right" height="20"><input type="text" name="firstname" id="firstname" style="width: 395px; height: 20px; border: 0px; font-family: arial; color: #bababa; padding-left: 3px; font-size: 11pt;"></td>
</tr>
<tr>
	<td height="17"> </td>
</tr>
<tr>
	<td align="right" height="20"><input type="text" name="lastname" id="lastname" style="width: 395px; height: 20px; border: 0px; font-family: arial; color: #bababa; padding-left: 3px; font-size: 11pt;"></td>
</tr>
<tr>
	<td height="17"></td>
</tr>
<tr>
	<td align="right" height="20"><input type="text" name="profession" id="profession" style="width: 338px; height: 20px; border: 0px; font-family: arial; color: #bababa; padding-left: 3px; font-size: 11pt;"></td>
</tr>
<tr>
	<td height="17"></td>
</tr>
<tr>
	<td align="right" height="20"><input type="text" name="company" id="company" style="width: 395px; height: 20px; border: 0px; font-family: arial; color: #bababa; padding-left: 3px; font-size: 11pt;"></td>
</tr>
<tr>
	<td height="12"></td>
</tr>
<tr>
	<td align="right" height="20"><input type="text" name="email" id="email" style="width: 395px; height: 20px; border: 0px; font-family: arial; color: #bababa; padding-left: 3px; font-size: 11pt;"></td>
</tr>
<tr>
	<td height="12"></td>
</tr>
<tr>
	<td height="21"><input type="text" name="day" id="day" maxlength="2" style="margin-right: 19px; width: 31px; height: 20px; border: 0px; color: #bababa; font-size: 11pt; font-family: arial;"><input type="text" name="month" id="month" maxlength="2" style="margin-right: 19px; width: 31px; height: 20px; border: 0px; color: #bababa; font-size: 11pt; font-family: arial;"><input type="text" name="year" id="year" maxlength="4" style="width: 35px; height: 20px; border: 0px; color: #bababa; font-size: 11pt; font-family: arial;">               <select name="gender" id="gender"><option value="Male">Male</option><option value="Female">Female</option>
</select></td>
</tr>
<tr>
	<td align="right" height="37"><input type="image" name="next_button" src="images/reg_button_next.jpg" alt="Goto The Next Step"></td>
</tr>
</table>
Max_admin 16 Mar, 2007
Hello,

try to create a nother form ? try to choose all fileds when youare creating the table, just leave the button, try some scnearions and let me know if the problem still exists or at some conditions, this component will be better by everybody's help🙂
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
rusty 16 Mar, 2007
Yup it works when I select all fields but not when I select the ones I want
Max_admin 17 Mar, 2007
Ok, a temperary solution is to choose whatever solution works for now as long as it saves all the data u need, then Iam going to debug this issue🙂

Cheers,

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
rusty 19 Mar, 2007
Ok I found an issue that will make this inoperable to me having 2 fields with the same name wont create a table for example radio buttons with the same name it picks them up in the create table form but when I select only one it still trys to add duplicate entries into mysql and the code bombs out with the same sql error "Duplicate field error"
rusty 20 Mar, 2007
I have fixed the issue in admin.chronocontact.php by changing the checkbox handlers in these functions:


function maketableChronoContact( $id, $option ) {
	global $database, $mosConfig_dbprefix;
	$result = $database->getTableList();
	if (in_array($mosConfig_dbprefix."chronoforms_".$id, $result)) {
	//echo $mosConfig_dbprefix."_chronoforms_".$id;
		//echo "A table has already been created for this form";
		HTML_ChronoContact::maketableChronoContact( $row, $option, "exists" );
	} else {
		$row = new mosChronoContact( $database );
		$row->load( $id );
		$typelist = '		<option value="VARCHAR(255)">Small number of characters - VARCHAR(255)</option>			
						<option value="TEXT">Medium number of text - TEXT</option>
						<option value="LONGTEXT">Biggest number of text - LONGTEXT</option>	
						<option value="INT(11)">Medium number of numbers ONLY - INT(11)</option>			
						<option value="INT(22)">Long number of numbers ONLY - INT(22)</option>			
						<option value="INT(6)">Short number of numbers ONLY - INT(6)</option>			
						
					</select>';
		$htmlstring = $row->html;
		preg_match_all('/name=("|\').*?("|\')/i', $htmlstring, $matches);
				$i = 0;
				foreach ($matches[0] as $match)
				{
					$new_match = preg_replace('/name=("|\')/i', '', $match);
					$new_match2 = preg_replace('/("|\')/', '', $new_match);
					$name = preg_replace('/name=("|\')/', '', $new_match2);
					if ($i == 0) {
						$html_message.= "<table><table><tr height='10'><td width='30' nowrap><strong>Create column?</strong></td><td width='30'></td><td width='50' class='tablecell1'><strong>Column name</strong></td><td width='30'></td><td class='tablecell2'><strong>Column type</strong></td></tr>";
					}
					$html_message.= "<tr height='10'><td width='30'><!--<input type='checkbox' name='cf_".$name."' id='cf_".$name."' value='1'>--><input type='checkbox' name='cf_cb[]' id='cf_cb[]' value='".$name."' checked></td><td width='30'></td><td width='50' class='tablecell1'>";
					$html_message.= $name."</td><td width='30'></td><td class='tablecell2'>";
					$html_message.= '<select name="fieldtype_'.$name.'">'.$typelist."</td></tr>";
					$i++;
				}
				$html_message.= "</table>";
				//echo $html_message ;
	
		HTML_ChronoContact::maketableChronoContact( $row, $option, $html_message );
	}
}
function finalizetableChronoContact( $option ) {
	global $database;
	$id = $_POST['formid'];
	$row = new mosChronoContact( $database );
	$row->load( $id );
	$htmlstring = $row->html;
	preg_match_all('/name=("|\').*?("|\')/i', $htmlstring, $matches);
	$i = 1;
	$chrono_fields = array();
	$chrono_posts = "";
	$table_sql_body = "`cf_id` INT( 11 ) NOT NULL AUTO_INCREMENT , `recordtime` TEXT NOT NULL ,";
	foreach($_POST["cf_cb"] AS $key => $value){

		$chrono_fields[] = $value;
		if($i > 1) $table_sql_body .= " , ";
		$table_sql_body .= "`".$value."` ".$_POST['fieldtype_'.$value]. " NOT NULL";
		if($i > 1) $chrono_posts .= " , ";
		$chrono_posts .= "'\".$"."_POST['$value'].\"'";
		$i++;
	}
	if ( count($chrono_fields) > 0){
		$table_sql = "CREATE TABLE `#__chronoforms_".$id."` (";
		$table_sql .= $table_sql_body ." , PRIMARY KEY ( `cf_id` )";
		$table_sql .= "«») ENGINE = MYISAM ;";
	}
	//die($table_sql);
	$database->setQuery( $table_sql );
	if (!$database->query()) {
		echo "<script> alert('".$database->getErrorMsg()."'); window.history.go(-1); </script>\n";
		exit();
	}
	$chrono_onsubmit = "<?php 
	global $"."database;
$"."database->setQuery( \"INSERT INTO #__chronoforms_".$id." VALUES  (
'' , '\". date('Y-m-d').\" - \".date(\"H:i:«»s\"«»).\"' , ".$chrono_posts."«»);\" );
if (!$"."database->query()) {
echo \"<script> alert('\".$"."database->getErrorMsg().\"'); window.history.go(-1); </script>\n\";
}
?>";
	$row = new mosChronoContact( $database );
	$row->load( $id );
	$row->autogenerated = $chrono_onsubmit;
	if (!$row->store()) {
		echo "<script> alert('".$row->getError()."'); window.history.go(-1); </script>\n";
		exit();
	}
	mosRedirect( 'index2.php?option='.$option );
			
}
This topic is locked and no more replies can be posted.

VPS & Email Hosting 20% discount
hostinger