This is the community forum. For a developer response use the Client Area.
Follow us on Facebook, Twitter and YouTube!

add new checkbox / pass mail to own db
#1

hey folks,

as im modifying the commentics script for my website i have maybe the last problem Big Grin
i want wo write the email of a person who comments in a seperate db. so i need a extra checkbox for this. no problem, just added this to the includes\template\form.php

Quote:<div class="cmtx_label">&nbsp;</div>
<input name="check_newsletter" type="checkbox" class="cmtx_checkbox_field" value="X" />
<span class="cmtx_notify_text">Get Newsletter</span>

Ok, now i want to check this new checkbox and add, if the checkbox is checked, the mail in my own newsletter db. i tried the following:

PHP Code:
<?php 
if (isset($_POST['cmtx_submit'])) {
$name = $_POST['cmtx_name'];
$email = $_POST['cmtx_email'];
if (isset(
$_REQUEST['check_newsletter'])) {
$insert_newsletter = "X";
}
if (
$insert_newsletter == "X") {
mysql_query ("INSERT INTO `newsletter` (`name` ,`email`) VALUES ('$name', '$email')");
}
}
but it doesn't work. i cant even check if the form is submittet.

PHP Code:
<?php 
if (isset($_POST['cmtx_submit'])) {
echo
"submitted";
}
Nothing happens - but why? Huh
Reply
#2

Ok, found out that i have to use my code in the includes\app\processor.php.

The insert query works finde but i cant figure out how to insert only when no error occures, the submit button was pressed and my checkbox was aktivated. the following dont work:

PHP Code:
<?php 
if ((isset($_POST['cmtx_newsletter'])) and (isset($_POST['cmtx_submit'])) and (empty($cmtx_error))) {
insert
}
Reply
#3

Reply
#4


Have you completed the interview?
Reply
#5

thanks a lot! that worked great Smile
Reply


Possibly Related Threads…
Thread / Author Replies Views Last Post
Last Post by Steven
23-Feb-2014, 01:57 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)