totally confused
i will place the code and steps i have done..
STEP 1. made a snipplet call eForm2db and placed this code...
<?php
function eForm2db( &$fields )
{
/*---------------------------------------------------------------
eForm2db
Version: 0.1 [Beta 1]
Author: pixelchutes
---------------------------------------------------------------
Requirements:
eForm 1.4+
---------------------------------------------------------------
Use:
- Takes validated eForm submittal data for use with the MODx DBAPI extender class.
- Easily process database records referencing your form submission data:
+ INSERT new records to a table of your choice
+ UPDATE existing records if you’d prefer
+ DELETE records based on form submittal criteria
+ Form a query and return its record set as XML using $modx->db->getXML
+ Query a table’s MetaData using $modx->db->getTableMetaData, followed by an update query
on only the form fields that are named after table columns!
+ and much more!
---------------------------------------------------------------*/
// Bring needed resources into scope
global $modx, $table_prefix;
// Init our array
$dbTable = array(); // key = DB Column; Value = Insert/Update value
// Insert field/value pairs to insert/update in our table
$dbTable[name] = $fields[first_name].’ ’.$fields[last_name]; // Merge two form fields together
$dbTable[datetime] = date( ’YmdHis’, strtotime( $fields[postdate] ) ); // Massage the postdate timestamp to be MySQL insert friendly
// INSERT - $dbQuery = $modx->db->insert( $dbTable, $table_prefix . ’insertTableName’ );
// UPDATE - $dbQuery = $modx->db->update( $dbTable, $table_prefix . ’updateTableName’ );
// DELETE - $dbQuery = $modx->db->delete( $table_prefix . ’deleteFromTableName’, ’some_field = 1 AND name=\’’.$dbTable[name].’\’’, ’’ );
// etc...
// Run the db insert query
$dbQuery = $modx->db->insert( $dbTable, $table_prefix . ’insertTableName’ );
return true;
}
// Return empty string
return ’’;
?>
STEP 2. made a snipplet called ’memberstable’ and placed this code...
<?php
$where=(isset($region))?’region="’.$region.’" ’:’’;
$orderby =’name’;
$result=$modx->db->select(’*’,$modx->getFullTableName(’members’),$where,$orderby )
$rows=$modx->db->makeArray($result);
$output=’<table>’;
foreach ($rows as $row){
$output.=’<tr>’;
$output.=’<td>’.$row[’suburb’].’</td>’;
$output.=’<td>’.$row[’centre’].’</td>’;
$output.=’<td>’.$row[’street’].’</td>’;
$output.=’<td>’.$row[’contact’].’</td>’;
$output.=’<td>’.$row[’phone’].’</td>’;
$output.=’<td>’.$row[’email’].’</td>’;
$output.=’<td>’.$row[’website’].’</td>’;
$output.=’</tr>’;
}
$output.=’</table>’;
return $output;
?>
STEP 3. made a Members Form page containing this code...
[!eForm? &noemail=`true` &formid=`MembersForm` &eFormOnBeforeMailSent=`eForm2db` &tpl=`MembersForm` &gotoid=`57` !]
STEP 4. made a chunk called ’MembersForm’ with this code...
i think the post action should be something else?
<p class="error">[+validationmessage+]</p>
<form method="post" action="[~[*id*]~]" id="EmailForm" name="EmailForm">
<fieldset>
<h3> Your Details </h3>
<input name="formid" type="hidden" value="ContactForm" />
<label for="cfSuburb">Suburb:
<input name="name" type="text" class="text" id="cfSuburb" size="40" />
</label>
<label for="cfCentre">Centre:
<input name="name" type="text" class="text" id="cfCentre" size="40" />
</label>
<label for="cfStreet">Street:
<input name="name" type="text" class="text" id="cfStreet" size="40" />
</label>
<label for="cfContact">Contact:
<input name="name" type="text" class="text" id="cfContact" size="40" />
</label>
<label for="cfPhone">Phone:
<input name="name" type="text" class="text" id="cfPhone" size="40" />
</label>
<label for="cfRegion">
Region:</label>
<select name="subject" id="cfRegion" >
<option value="North">North</option>
<option value="South"> South</option>
<option value="West">West</option>
<option value="East">East</option>
<option value="Regional">Regional</option>
</select>
<label for="cfEmail">
Your Email Address:
<input name="email" type="text" class="text" id="cfEmail" size="40" />
</label>
<label for="cfWebsite">
Your Website Address:
<input name="email" type="text" class="text" id="cfWebsite" size="40" />
</label>
<label>
</label>
<input type="submit" name="contact" id="cfContact" class="formborder" value="Send" />
</fieldset>
</form>
STEP 5. made a test page with this code in it...
[!memberstable? ®ion=`north`!]
and it’s displaying this error
Parse error: syntax error, unexpected T_VARIABLE in /home/communit/public_html/members/manager/includes/document.parser.class.inc.php(769) : eval()’d code on line 5
thanks anyone that can help