Using check box to hide form submitted by addForm.php

3 posts by 2 authors in: Forums > CMS Builder
Last Post: October 1, 2010   (RSS)

Re: [Jeffncou] Using check box to hide form submitted by addForm.php

By Jason - October 1, 2010

Hi,

What you would need to do is to add to the SQL query that inserts the record into your database. What you would want to do is to set the value of your checkbox field (I'm assuming your using hidden) to 1 (this is the value of checked).

This should get you started. If you have any questions, let me know and attach addForm.php to this thread.

Thanks
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Using check box to hide form submitted by addForm.php

By JeffC - October 1, 2010

Thanks, that sorted it.

To expand on Jasons advice I added hidden = '1', to the SQL query

Here is the code in full

if (!@$errorsAndAlerts) {
mysql_query("INSERT INTO `{$TABLE_PREFIX}reader_recommendations` SET
title = '".mysql_real_escape_string( $_REQUEST['title'] )."',
first_name = '".mysql_real_escape_string( $_REQUEST['first_name'] )."',
email = '".mysql_real_escape_string( $_REQUEST['email'] )."',
review = '".mysql_real_escape_string( $_REQUEST['review'] )."',
newsletter_sign_up = '".(@$_REQUEST['newsletter_sign_up'] ? '1' : '0')."',

hidden = '1',
createdDate = NOW(),
updatedDate = NOW(),
createdByUserNum = '0',
updatedByUserNum = '0'")
or die("MySQL Error Creating Record:<br/>\n". htmlspecialchars(mysql_error()) . "\n");
$recordNum = mysql_insert_id();

Jeff