cforms II User Forum

Registration is currently disabled.


Login form protected by Login LockDown.

Lost password?
Advanced Search

— Forum Scope —


— Match —


— Forum Options —


Wildcard usage:
*  matches any number of characters    %  matches exactly one character

Minimum search word length is 4 characters - maximum search word length is 84 characters

Topic RSS
Process Post Data
January 10, 2008
2:35 pm

Please replace the ??? with your data!

  • Your URL: http://
  • The browser used: Firefox
  • cforms version: 7.11
  • Your Wordpress version: 2.3.2

[desc]: First of all Oliver, thankyou for your excellent plugin. I particularly like the ease of use with smtp servers. I have almost completed my first real world web application and this is my final step. I am trying to send data from my form to a different table using the process post data function you describe in the help section. I have included the new action in my functions.php file and the database talks to the table but I am not sure how to match the variable names from the form with those in my table. Any assistance would be greatly appreciated. Here is my code:

function process_data($cformsdata) {

    $formID = $cformsdata['id'];      // Note: $formID = ''(empty) for the first form!
    $form   = $cformsdata['data'];    // & form data
    if ( $formID == '2' ) {           // your third form (1st form would be '' !)
        foreach ( array_keys($form) as $key )
        $name = addslashes(stripslashes(strtolower($_POST['name'])));
        $email = addslashes(stripslashes(strtolower($_POST['email'])));
        $url = addslashes(stripslashes(strtolower($_POST['url'])));
        $focus = addslashes(stripslashes(strtolower($_POST['focus'])));
        $volume = ($_POST['volume']);        
        $db = mysql_connect('localhost', 'username', 'password');
        $insertSQL = "INSERT INTO `table`(`name`,`email`,`url`,`focus`,`volume`) VALUES (\\"$name\\",\\"$email\\",\\"$url\\",\\"$focus\\",\\"$volume\\")" ;
        $result = mysql_query($insertSQL, $db) or die(mysql_error());        


Kind regards,


January 10, 2008
7:21 pm
Munich, Germany
Forum Posts: 6400
Member Since:
March 6, 2005

Does you above script at least create a table row (even with false/empty data)?
Is that part working?

The foreach loop seems broken above and the data I would access differently, try this:

Drop the foreach loop completely and set the variables by accessing the form array:

$name = $form['name'];

$email= $form['email'];


January 11, 2008
2:45 am

As I suspected… you confirmed my thinking. Thankyou so much Oliver. This works and makes your plugin truly the most powerful piece of open source form creation and management software I have encountered. Your attention to detail is remarkable.

I can now use your plugin to create and manage forms and send the data to my own tables for use in other applications. 

I will be sending a donation of gratitude your way.

Kind regards,


January 11, 2008
7:44 am
Munich, Germany
Forum Posts: 6400
Member Since:
March 6, 2005

Excellent, I'm glad it is working now!

Forum Timezone: Europe/Berlin

Most Users Ever Online: 959

Currently Online:
28 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

tracedef: 43

mores: 21

Gyrus: 20

frozenwaste: 18

asuffredini: 15

photoworks: 14

Member Stats:

Guest Posters: 3757

Members: 1463

Moderators: 3

Admins: 2

Forum Stats:

Groups: 1

Forums: 4

Topics: 5355

Posts: 18732

Newest Members: juredujmovic, dreamkeeper, rajattyagi, wrokaa, lukass

Moderators: Paul (421), cnymike (8), sonika (95)

Administrators: Oliver (6400), Nicky (3)