PHP - Trouble Getting Checkbox On Form Uploaded To Sql
Hi. My form involves a checkbox. Below is the code. The problem is that when I am not sure what to put on the php. I need for people to be able to check one box tow boxes or all three boxes. On the form side I have this: type="checkbox" name="formcheck[]" value="C". Not sure what to put on the php side and need some assistance
Code: [Select] <label style="display: block; padding-left: 15px; text-indent: -15px; width:650px;"> <input style="width: 45px; height: 45px; padding: 0; margin:0; vertical-align: bottom; position: relative; top: -1px; *overflow: hidden;" type="checkbox" name="formcheck[]" value="A" /> Directory Listing </label> <label style="display: block; padding-left: 15px; text-indent: -15px;width:650px;"> <input style="width: 45px; height: 45px; padding: 0; margin:0; vertical-align: bottom; position: relative; top: -1px; *overflow: hidden;" type="checkbox" name="formcheck[]" value="B" /> Full page listing </label> <label style="display: block; padding-left: 15px; text-indent: -15px;width:650px;"> <input style="width: 45px; height: 45px; padding: 0; margin:0; vertical-align: bottom; position: relative; top: -1px; *overflow: hidden;" type="checkbox" name="formcheck[]" value="C" /> Receive a link to your website </label> Similar TutorialsHi all, I have a situation where I need to remember what check boxes where checked over pagination, I have managed to do this via the use of this: http://jamesfunk.com/wordpress/?p=65 The problem is that as the code stood: Code: [Select] <input type="checkbox" name="compare" value="<?php echo $list['jobseeker_id'];?>" class="remember_cb"/> It was treating one ticked checkbox as them all because they all have the same name and are in the a while loop! I countered this by changing the code to: Code: [Select] <input type="checkbox" name="compare<?php echo $list['jobseeker_id']?>" value="<?php echo $list['jobseeker_id'];?>" class="remember_cb"/> Which effectively now makes the checkbox name unique... i.e. compare{id}. The problem with this is that I can now no longer process it. This is my processing code: $jobseekers = $_POST['compare']; $i = 0; for($i; $i<count($jobseekers); $i++){ $query = "SELECT * FROM jobseekers WHERE jobseeker_id = '$jobseekers[$i]'"; $result = mysql_query($query) or die (mysql_error()); while ($row = mysql_fetch_array($result)) { // Spit out the required data } } As you can see I am trying to get the data from $_POST['compare'], which will obviously now be blank as I have had to make the name unique.... the trouble is I'm not sure how to actually process this. Can anyone help me out here? any help or advice would be greatly appreciated! many thanks, Greens85 I'm having some trouble that I can't seem to figure out.. I've got a form with a file input area to upload an image. I just wanted to go through a if statement to check if a file was uploaded (which is required), however, even when I select a file to upload and submit, I still get the error echoing out as if nothing was uploaded. <?php if(!empty($_POST['submitFeature'])) { // set variables $featurename = mysql_real_escape_string($_POST['featurename']); $featuredesc = mysql_real_escape_string($_POST['featuredesc']); $src = $_FILES['featureupload']['tmp_name']; // 1 - A. REQUIRED FIELDS VERIFICATION if(!empty($featurename) && !empty($_FILES['featureupload']['tmp_name'])) { echo 'Image uploaded!'; } else { if (empty($_FILES['featureupload']['tmp_name'])) { echo 'No image uploaded.'; } } // 1 - B. END REQUIRED FIELDS ERROR CODES } ?> <form action="<?php $_SERVER['PHP_SELF']; ?>" method="post"> <div class="formSec"><label for="featurename" class="required">Feature Name:</label> <input type="text" name="featurename" id="featurename" value="" /></div> <div class="formSec"><label for="featureupload" class="required">Upload Featu </label> <input type="hidden" class="hidden" name="max_file_size" value="9999999999999" /> <input type="file" name="featureupload" id="featureupload" /></div> <input class="submit" type="submit" name="submitFeature" value="Submit Your Feature" /> </form> I'm beginning with simple codes to understand how things work and work my way up with what I need. My upload form looks like this: <form name="upload about" action="display.php" enctype="multipart/form-data" method="post"> Header: <input type="text" name="header" /> Body: <input type="text" name="body" /> <input type="hidden" name="MAX_FILE_SIZE" value="30000" /> Image: <input type="file" name="pic" /> <input type="submit" /> </form> And my display page is just as simple. <?php echo $_POST["header"]; ?> <?php echo $_POST["body"]; ?> <?php echo $_FILES['pic']['name']; ?> The problem is, whenever I submit the data, everything is fine, except the image does not display and just posts the filename of the image I uploaded. According to my research setting the enctype to multipart/formdata should display the image, but it does not. Can anyone tell me what's wrong? i have this in a loop and a form Code: [Select] <input type='checkbox' name='$topic' value='No' /> on the page the form directs to. How do i get each separate topic that has been checked? This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=326600.0 Hi: Is this the correct way to do a memory form for a checkbox? Code: [Select] <input name="status[]" id="pending" value="<?=$_POST['pending'] ?>" type="checkbox" /> if($x==""){
$x=1;
}
while($do=mysql_fetch_array($sql){
<form name='Form' action='posting.php' method='post'>
<input type='checkbox' name='<?php print $x; ?>' value='<?php print $do[id]; ?>' />
<input type='submit' name='checked' value='checking'>
$x++;
}
When I click on the submit button, only one value of $x is sent to posting.php instead of multiple loop values in checkbox. Does anyone have a solution to it ?
Under Posting.php
for ($x = 1; $x <= 20; $x++) { $x=$_POST[$x]; echo "$x"; } Edited by sungpeng, 16 October 2014 - 09:41 PM. Why is it grouping the checked boxes instead of keeping them in order like area is? if(isset($_POST['submit'])){ for($i=0; $i<10; $i++){ echo "<br />Ignore = [".$_POST['ignore'][$i]."]"; if($_POST['ignore'][$i]!="true") echo ", Area = ".$_POST['area'][$i]; } } else { echo "<form method='post'><table>"; for($i=0; $i<10; $i++){ echo " <tr> <td><input type='checkbox' name='ignore[]' value='true' /></td> <td><input type='text' name='area[]' /></td> </tr>\n"; } echo " </table> <input type='submit' name='submit' value='Submit' /> </form>"; } Input: Quote Checked - ignored Unchecked - a Checked - ignored2 Unchecked - b Checked - ignored3 Unchecked - c Unchecked - d Checked - ignored4 Unchecked - e Checked - ignored5 Output: Quote Ignore = [true] Ignore = [true] Ignore = [true] Ignore = [true] Ignore = [true] Ignore = [], Area = c Ignore = [], Area = d Ignore = [], Area = ignored4 Ignore = [], Area = e Ignore = [], Area = ignored5 This is related to how PHP processes checkboxes in a form. I have a checkbox in a form called chkNewpart: $s='<tr><td>Model: <td><input type="text" name="txtModelnum" id="txtModelnum" value="'.$row['modelnum'].'" size="20" maxlength=15 />'; $s.=' New part? <input type="checkbox" name="chkNewpart" value="'.$newpartvar.'" '; $s.='checked="'; if ($newpartvar==1) { $s.='checked'; } $s.='" />'; $s.='</tr>'; In my db, the field that holds this value is a tinyint, and the default is 1, which stands for true. So when I display the checkbox, if the value of the field is 1, then the box should be checked. That part works. The problem I have is when I uncheck the box and save the checkbox to a php variable, and then the database field. $newpartvar=$_POST['chkNewpart']; ... $query = "UPDATE parts SET modelnum='".$modelvar."', ". "prodcat='".$prodcatvar."', ". "prodname='".$prodnamevar."', ". "prodsubname='".$prodsubnamevar."', ". "newflag="; if ($newpartvar==1) { $query.="1"; //True } else { $query.="0"; //False } $query.=", "; $query.="updateuser='".$_SESSION['username']."', ". "updatedate=NOW() ". "WHERE partid=".$partidvar.";"; I get no errors but php doesn't seem to change the field value, when I look at it in PHP Admin. How do I handle the values of checkboxes properly? I'd like 1 to be true and 0 to be false. Hi, I am using check box group in my php form, The user can choose multiple answers, if he choose 3 answers and the form is submitted only one answer is displayed in mysql Code: [Select] GetSQLValueString($_POST['father'], "text"), any help please? Thanks Hey I'm a beginner at this and I was hoping the answer might be something simple. I'll post the code if needed, but it might just be something simple. I have a contact form with a php script to email me when a user enters information. I have a checkbox for whether or not a user wants to receive our newsletter. When a user fills in his/her information. Clicks the checkbox to receive our newsletter, then clicks submit they are then taken to a thank you page and I receive an email with their info, etc. When a user fills in his/her information. DOES NOT click the checkbox, then clicks submit, nothing on the screen changes, but I still receive the email with their info. Why is this happening? What am I missing with this checkbox? How do I get the thank you page to still display if they DO NOT click the checkbox? Any thoughts would be appreciated. Hi all, Im creating a simple quiz where some of the questions are checkbox because there is more than one correct answer. What I would like to be able to do, is run an if statement to check if, say for example, options 1 and 5 out of 6 have been selected, then award the point. However the point is only awarded is both options are selected. Any suggestions? Thank you in advance helo does anyone know how to display data from db in checkbox form? i have been searching for days and still cannot find answer that i can understand. i hope someone can help me. i really am lost. any help is much appreciated Hello all I am working on creating a basic ordering form that allow the user to use check-boxes to select certain products and than return a total back to them. I am having a hard time figuring out the php code to gather and calculate things. What I dont quite understand is how to pass the data properly so my $sum calculation actually knows what the values are... In my html doc I have my checkboxes as follows: //formatted in tables <input type = "checkbox" name = "eight100wattreg" size ="40" /> <input type = "checkbox" name = "four100wattreg" size ="40" /> //etc.... and in my php doc: <?php> //get form values $four100wattreg = $_POST["four100wattreg"]; $eight100wattreg = $_POST["eight100wattreg"]; $four100wattlong = $_POST["four100wattlong"]; $eight100wattlong = $_POST["eigth100wattlong"]; $payment = $_POST["payment"]; //set lightbulb values $four100wattreg=2.39; $eight100wattreg=2.39; $four100wattlong=2.39; $eight100wattlong=2.39; //calculate costs if (isset($_POST['four100wattreg']) { //checkbox is checked $four100wattreg = $_POST['four100wattreg']; } else if (!isset($_POST['checkbox']) { //checkbox not checked $four100wattreg = 0; } $sum = $four100wattreg + $eight100wattreg + $four100wattlong + $eigth100wattlong; ?> <?php> echo "Your total is: '$sum' <br />"; ?> I also attached the files if someone wants to look at them in they're entirety. Any advice would be greatly appreciated, but please keep in mind I am a php beginner and am still learning. Thanks, Charlie Trying to fix existing some code (complete beginner here) on the company I work for website. There's a check-box which when ticked should apply delivery charges and if not it shouldn't - currently it's working in that on the same page it calculates the total cost correctly when checked or not checked but when passing on information it always passes on the delivery charge even if un-ticked... The simplest thing I can see would be to put an if statement in to say if (not ticked) then del_charges = 0.00. Any idea how I can do this in this instance? Code: [Select] <?php // add a checkbox for delivery charges echo '<span class="form"><label>Delivery Charges</label>'; echo '<input type="checkbox" name="del_charges" id="del_charges" value="1" class="boxes" '; if ( isset($_POST['del_charges']) && !empty($_POST['del_charges']) ) echo 'checked="checked"'; echo '/>'; ?> Thanks. So I got help from here earlier with one problem and a few more have arisen, the biggest is for some reason my checkbox and dropdown array won't store the data and when it's supposed to check to verify there is at least 1 selected of each nothing happens... To be honest the ideal thing would be to have it check to see if the drop down size selection below the checkbox was selected, but I'll do whatever as long as it works. Thanks ahead of time for the help. Here's my page code: Code: [Select] <html> <HEAD> </head> <body> <?php require_once "formvalidator.php"; $error_hash = 'no'; $show_form = true; class MyValidator extends CustomValidator { function DoValidate(&$formars,&$error_hash) { if(stristr($formars['comments'],'http://')) { $error_hash['comments']="No URLs allowed in comments"; return false; } return true; } } if ($_SERVER['REQUEST_METHOD'] == "POST") { $validator = new FormValidator(); $validator->addValidation("email", "email", "<B>Email address is invalid.</B>"); $validator->addValidation("first", "req", "<B>Please provide your First name for invoice.</B>"); $validator->addValidation("last", "req", "<B>Please provide your Last name for invoice.</B>"); $validator->addValidation("addr", "req", "<B>Please provide your address for invoice.</B>"); $validator->addValidation("city", "req", "<B>Please provide your city name for invoice.</B>"); $validator->addValidation("state", "req", "<B>Please provide your State for invoice.</B>"); $validator->addValidation("zip", "num", "req", "<B>Please provide your zip for invoice.</B>"); $validator->addValidation("phone", "num", "<B>Numbers only in phone number.</B>"); if ($validator->ValidateForm()) { $show_form = false; } else { echo "<center><font color='#CC0000'><B>Validation Errors:</B></font></center>"; $error_hash = $validator->GetErrors(); foreach ($error_hash as $inpname => $inp_err) { echo "<center><p>$inpname : $inp_err</p></center>\n"; $show_form = true; } } $pic = $_POST['pic']; if(empty($pic)) { echo "<center><font color='#CC0000'><B>Please Select a picture.</B></font></center>"; } else { $r = count($pic); for($i=0; $i < $r; $i++) { echo "picture(s) requested $i was: " . $pic[$i] . "\r\n"; } } $size = $_POST['size']; if(empty($size)) { echo "<center><font color='#CC0000'><B>Please Select a picture size.</B></font></center>"; } else { $r = count($size); for($i=0; $i < $r; $i++) { echo "Sizes(s) requested $i was: " . $size[$i] . "\r\n"; } } if ($show_form === false){ // Grab the form vars $Pic = $_POST['pic'] ; $Size = $_POST['size'] ; $Email = $_POST['email']; $Name = $_POST['first'. 'last']; $Addr = $_POST['addr']; $City = $_POST['city']; $State = $_POST['state']; $Zip = $_POST['zip']; $comments = $_POST['comments'] ; //message body $mail_body .= "$Pic"."\r\n"; $mail_body .= "$Size"."\r\n"; $mail_body .= "$Email"."\r\n"; $mail_body .= "$Name"."\r\n"; $mail_body .= "$Addr"."\r\n"; $mail_body .= "$City,". " $State". " $Zip"."\r\n"; $mail_body .= "$Comments"."\r\n"; //sending to $recipient = "hakarune@gmail.com"; $subject = "Order Form"; //Headerfields $header = "From: " . $Email . " <" . $Email . ">\r\n"; //mail command mail($recipient, $subject, $mail_body, $header); echo "<div style='width:400px; margin:0 auto; border:1px solid #1e1e1e'>Your order has been sent successfully. <br>An Invoice will be either emailed or mailed to you, thank you for your order.<br>You will be redirected to the home page in 10 seconds...</div>"; //page redirect to home echo "<META HTTP-EQUIV=\"refresh\" content=\"10;URL=buttontest3.php\">"; } } if (true == $show_form) { ?> <form name="ordering" action="" method="POST"> <img src="1.jpg" /> <input type="checkbox" name="pic[]" value="1"> <br /> <select name="Type" size="1" name="size[]"> <option value="">Select Type</option> <option value="Original">Original $Price</option> <option value="Print Small">300x500 Print $Price</option> <option value="Print Medium">800x600 Print $Price</option> <option value="Print Large">1200x1280 Print $Price</option> <option value="Print XLarge">1282x1400 Print $Price</option> </select> <br /> <img src="2.jpg" /> <input type="checkbox" name="pic[]" value="2"> <br /> <select name="Type" size="1" name="size[]"> <option value="">Select Type</option> <option value="Original">Original $Price</option> <option value="Print Small">300x500 Print $Price</option> <option value="Print Medium">800x600 Print $Price</option> <option value="Print Large">1200x1280 Print $Price</option> <option value="Print XLarge">1282x1400 Print $Price</option> </select> <br /> <img src="3.jpg" /> <input type="checkbox" name="pic[]" Value="3"> <br /> <select name="Type" size="1" name="size[]"> <option value="">Select Type</option> <option value="Original">Original $Price</option> <option value="Print Small">300x500 Print $Price</option> <option value="Print Medium">800x600 Print $Price</option> <option value="Print Large">1200x1280 Print $Price</option> <option value="Print XLarge">1282x1400 Print $Price</option> </select> <br /> <img src="4.jpg" /> <input type="checkbox" name="pic[]" value="4"> <br /> <select name="Type" size="1" name="size[]"> <option value="">Select Type</option> <option value="Original">Original $Price</option> <option value="Print Small">300x500 Print $Price</option> <option value="Print Medium">800x600 Print $Price</option> <option value="Print Large">1200x1280 Print $Price</option> <option value="Print XLarge">1282x1400 Print $Price</option> </select> <br /> <img src="5.jpg" /> <input type="checkbox" name="pic[]" value="5"> <br /> <select name="Type" size="1" name="size[]"> <option value="">Select Type</option> <option value="Original">Original $Price</option> <option value="Print Small">300x500 Print $Price</option> <option value="Print Medium">800x600 Print $Price</option> <option value="Print Large">1200x1280 Print $Price</option> <option value="Print XLarge">1282x1400 Print $Price</option> </select> <br /> <br /> <br /> Information For Invoice: <font color="red">(Required Info = *)</font> <br /> <input type="text" name="first" Value="First Name" size="25" onfocus="value=''"><font color="red">*</font> <input type="text" name="last" Value="Last Name" size="25" onfocus="value=''"><font color="red">*</font> <br /> <input type="text" name="phone" Value="phone Number" size="25" onfocus="value=''"> <br /> <input type="text" name="email" Value="E-mail" size="30" onfocus="value=''"> <br /> <input type="text" name="addr" Value="Street Address" size="50" onfocus="value=''"><font color="red">*</font> <br /> <input type="text" name="city" Value="city" size="30" onfocus="value=''"><font color="red">*</font> <br /> <select name="state" size="1"> <option value="">Select State</option> <option value="AK">AK</option> <option value="AL">AL</option> <option value="AR">AR</option> <option value="AZ">AZ</option> <option value="CA">CA</option> <option value="CO">CO</option> <option value="CT">CT</option> <option value="DC">DC</option> <option value="DE">DE</option> <option value="FL">FL</option> <option value="GA">GA</option> <option value="HI">HI</option> <option value="IA">IA</option> <option value="ID">ID</option> <option value="IL">IL</option> <option value="IN">IN</option> <option value="KS">KS</option> <option value="KY">KY</option> <option value="LA">LA</option> <option value="MA">MA</option> <option value="MD">MD</option> <option value="ME">ME</option> <option value="MI">MI</option> <option value="MN">MN</option> <option value="MO">MO</option> <option value="MS">MS</option> <option value="MT">MT</option> <option value="NC">NC</option> <option value="ND">ND</option> <option value="NE">NE</option> <option value="NH">NH</option> <option value="NJ">NJ</option> <option value="NM">NM</option> <option value="NV">NV</option> <option value="NY">NY</option> <option value="OH">OH</option> <option value="OK">OK</option> <option value="OR">OR</option> <option value="PA">PA</option> <option value="RI">RI</option> <option value="SC">SC</option> <option value="SD">SD</option> <option value="TN">TN</option> <option value="TX">TX</option> <option value="UT">UT</option> <option value="VA">VA</option> <option value="VT">VT</option> <option value="WA">WA</option> <option value="WI">WI</option> <option value="WV">WV</option> <option value="WY">WY</option> </select> <br /> <input type="text" name="zip" Value="Zipcode" size="5" onfocus="value=''"><font color="red">*</font> <br /> <textarea name="comments" rows="5" cols="20" value="comments" onfocus="value=''"> </textarea> <br /> <input type="Submit" value="Submit"> <input type="reset" value="Clear Form"> </form> <?php }//true == $show_form ?> </body> </html> So, i need this. I know that there is a way to this with javascript, but I don't know how it would work. I am much more familiar with php so I figured I would ask here to see if anyone might have a good php solution. I'm trying to have a form text field display depending on whether or not the user checks a specific box, but I'm not sure where to start. I've searched around but I didn't find anything that would help. Basically I want to have a checkbox that asks if the user would like to link their account to an email address. If the checkbox is selected, a textbox will then appear on the page for them to enter an email address. Can anyone point me in the right direction on where to start? Thanks for your help. Code: [Select] <form action="checkbox-form.php" method="post"> <input type="checkbox" name="c1" value="1" /> Pending <input type="checkbox" name="c1" value="2" /> Approved <input type="checkbox" name="c1" value="3" /> Rejected <input type="button" name="formSubmit" value="Fetch Results"/> </form> <?php $con = mysql_connect("localhost","root","password"); if (!$con) { die('Could not connect:' . mysql_error()); } mysql_select_db("Products", $con); $result = mysql_query("SELECT * FROM btp_reviews" ); echo "<table border='1' cellspacing='0' cellpadding='0'>"; echo '<tr> <td>Id</td> <td>Review</td> <td>Name</td> <td>Update</td> <td>Status</td> </tr>'; while($row = mysql_fetch_assoc($result)) { echo '<tr>'; echo '<td>' . $row['id'] . '</td>'; echo "<td>" . strip_tags($row['review']) . "</td>"; echo "<td>" . $row['r_name'] . "</td>"; echo "<td>" ."<form action='radio.php' method='post' ><a href=http://localhost/editt.php?id=".$row['id'].">Edit</a>.</td> <td>" ."<input type='radio' name='r1' value='2' />Approve<br/><input type=hidden name=id value='".$row['id']."' /> <input type='radio' name='r1' value='3' /> Reject<br/> <input type=submit value=Submit /></form>"."</td>"; } echo "</table>"; mysql_close($con); ?> I'm not sure if this is a php issue or jquery issue. When I complete the form and hit submit it puts the successful message up like its supposed to but also with the fields still filled in the form which it shouldn't be doing and it doesn't actually post in the database so I'm not sure if its a php issue or jquery issue. Code: [Select] <script type="text/javascript"> $(document).ready(function() { $('div.message-error').hide(); $('div.message-success').hide(); $("input.submit").click(function() { $('div.message-error').hide(); var templatename = $("input#templatename").val(); if (templatename == "") { $("div.message-error").show(); $("input#templatename").focus(); return false; } var headercode = $("textarea#headercode").val(); if (headercode == "") { $("div.message-error").show(); $("textarea#headercode").focus(); return false; } var footercode = $("textarea#footercode").val(); if (footercode == "") { $("div.message-error").show(); $("textarea#footercode").focus(); return false; } var dataString = 'templatename='+ templatename+ '&headercode=' + headercode + '&footercode=' + footercode; $.ajax({ type: "POST", url: "processes/template.php", data: dataString, success: function() { $("div.message-success").show(); return true; } }); return false; }); }); </script> <!-- Form --> <form action="#" name="templateform" > <fieldset> <legend>Add New Template</legend> <div class="field required"> <label for="templatename">Template Name</label> <input type="text" class="text" name="templatename" id="templatename" title="Template Name"/> <span class="required-icon tooltip" title="Required field - This field is required, it cannot be blank, and must contain something that is different from emptyness in order to be filled in. ">Required</span> </div> <div class="field required"> <label for="headercode">Header Code</label> <textarea name="headercode" id="headercode" title="Header Code"></textarea> <span class="required-icon tooltip" title="Required field - This field is required, it cannot be blank, and must contain something that is different from emptyness in order to be filled in. ">Required</span> </div> <div class="field required"> <label for="footercode">Footer Code</label> <textarea name="footercode" id="footercode" title="Footer Code"></textarea> <span class="required-icon tooltip" title="Required field - This field is required, it cannot be blank, and must contain something that is different from emptyness in order to be filled in. ">Required</span> </div> <input type="submit" class="submit" name="submittemplate" id="submittemplate" title="Submit Template" value="Submit Template"/> </fieldset> </form> <!-- /Form --> <!-- Messages --> <div class="message message-error"> <h6>Required field missing</h6> <p>Please fill in all required fields. </p> </div> <div class="message message-success"> <h6>Operation succesful</h6> <p>Template was added to the database.</p> </div> <!-- /Messages --> validation page <?php // Include the database page include ('inc/dbconfig.php'); if ((isset($_POST['templatename'])) && (strlen(trim($_POST['templatename'])) > 0)) { $templatename = stripslashes(strip_tags($_POST['templatename'])); } else {$templatename = 'No name entered';} if ((isset($_POST['headercode'])) && (strlen(trim($_POST['headercode'])) > 0)) { $headercode = stripslashes(strip_tags($_POST['headercode'])); } else {$headercode = 'No name entered';} if ((isset($_POST['footercode'])) && (strlen(trim($_POST['footercode'])) > 0)) { $footercode = stripslashes(strip_tags($_POST['footercode'])); } else {$footercode = 'No name entered';} $query = "INSERT INTO `templates` (templatename, header, footer, creator_id, datecreated) VALUES ('".$divisionname."','".$headercode."','".$footercode."' 1, NOW())"; mysql_query($query); ?> |