PHP - Problem Comparing Substrings And Db Field Values
hey guys, i have my code set up to run substrings through a db to check for matches...even when there is a match it wont insert correctly
Code: [Select] $result = mysql_query("select * from friends where userid=$userid"); while($row = mysql_fetch_assoc($result)) { $first_name = $row['first_name']; $last_name = $row['last_name']; $strpos_1 = strpos($friend_1, ' '); $substr_1 = substr($friend_1, 0, $strpos_1); $substr_2 = substr($friend_1, $strpos_1); if($substr_1 == $first_name && $substr_2 == $last_name) { $sql = "insert into fav_friends values('', '$userid', '$friend_1', '$friend_2', '$friend_3', '$friend_4', '$friend_5', '$friend_6')"; $query = mysql_query($sql); } } and i don't receive any errors, any thoughts? Similar TutorialsHi. I have a MySQL database with 4 different fields. id, customer, case and status. No problems of getting them to show up on my page but.. I would like to change the row bgcolor depending of field value on "customer". For example row color would be white until customer changes, then color yellow until customer changes again and back to white etc.. Hope you get the point. Is this possible? Thanks. i've google but no luck on finding what i need....is there a way in javascript to compare 2 variables ie.
var him = "jack"; var her = "jill"; if (him == her){ alert('same name'); }thank you Hi im not sure if this can be done or not but im trying to do a site without using mysql and i want to be able to compare 3 values and depending on the values have them aranged lowest to highest... for example: Apple = 8 Pear = 3 Bannana = 5 so the results would be displayed like... Pear with a total of 3 bannana with a total of 5 Apple with a total of 8 Is this possible using just PHP or will i need to use Mysql as well... Thank you Chris Hi there i have 2 queries one for each table that calculates values in one or more fields. The two tables are different in structure so i have had to calculate them differently: | Ship table | Class |Planet table | Class 1 Class 2 Class 3 Class 4 Depending on what type of ship is added (Class 1-4 ship) its corresponding Class is determined. The planet table is different though as it can have any number of Class 1 - 4 ships. So with help ive put the Ship query results into an array and echoed the results. The Planet query is not in an array as such as i could acheive the same results using the SUM() function. Both work fine and the outputted results look like this: Ship query 1 Class 1 4 Class 2 3 Class 3 1 Class 4 Planet query 1 Class 1 2 Class 2 4 Class 3 13 Class 4 What i really need to do now is compare each queries Class and if the planets class 1-4 < ships class 1-4 then echo the difference. For example the results would be: Class 1 = 0 echo no Class 1 needed Class 2 = - 2 echo no Class 2 needed Class 3 = +1 echo 1 Class 3 needed Class 4 = +12 echo 12 class 4 needed Im sorry if it seems longwinded or if ive not explained my self very well but im finding it difficult. Heres the code: Code: [Select] <?php $colname_resultp = "-1"; if (isset($_SESSION['MM_Username'])) { $colname_resultp = (get_magic_quotes_gpc()) ? $_SESSION['MM_Username'] : addslashes($_SESSION['MM_Username']); } mysql_select_db($database_swb, $swb); $query_resultp = sprintf("SELECT SUM(Class1) As Class1_totla, SUM(Class2) As Class2_totla, SUM(Class3) As Class3_totla, SUM(Class4) As Class4_totla FROM planet WHERE PlayerName = %s", GetSQLValueString($colname_resultp, "text")); $resultp = mysql_query($query_resultp, $swb) or die(mysql_error()); $row_resultp = mysql_fetch_assoc($resultp); $totalRows_resultp = mysql_num_rows($resultp); $colname_Recordset1 = "-1"; if (isset($_SESSION['MM_Username'])) { $colname_Recordset1 = (get_magic_quotes_gpc()) ? $_SESSION['MM_Username'] : addslashes($_SESSION['MM_Username']); } mysql_select_db($database_swb, $swb); $query = sprintf("SELECT Class FROM ships WHERE PlayerName = %s ORDER BY Class ASC", GetSQLValueString($colname_Recordset1, "text")); $result = mysql_query($query, $swb) or die(mysql_error()); $number_of_results = array(); while($row = mysql_fetch_array($result)){ if (isset($number_of_results[$row['Class']])) { $number_of_results[$row['Class']]++; } else { $number_of_results[$row['Class']] = 1; } } foreach ($number_of_results as $class => $number_of_class) { echo $number_of_class . " Class " . $class; echo "<br />"; } <?php do { ?> <?php echo $row_resultp['Class1_totla']; echo ' Class 1'; echo'<br>'; echo $row_resultp['Class2_totla']; echo ' Class 2'; echo'<br>'; echo $row_resultp['Class3_totla']; echo ' Class 3'; echo'<br>'; echo $row_resultp['Class4_totla']; echo ' Class 4'; ?> <?php } while ($row_resultp = mysql_fetch_assoc($resultp)); mysql_free_result($result); mysql_free_result($resultp); ?> If you could please help that would be ace. Thanks for listening. Hey, Im needing some help with an update form that I have created using PHP/MySQL. Basically the form is working great (updating records, retrieving records and showing errors) but there is a problem with the errors. If there are no errors and I edit the existing text input values, the database updates fine. However if I edit the existing text input values and there is an error, the edited input values dont save, they revert back to the values of the database. I understand why this is happening, its because the text inputs are set to show the values of the database so if i edit the existing values and an error occurs or the page is refreshed, the values revert back to the database values. However id like it so that if any text in the text field have been edited and an error occurs, the text stays to how it is until the user by passes any errors and then the database is updated. Hopefully this makes sense. I have attached the php page just incase anybody wants to look into it but any help would be much appreciated! Also, im not looking for someone to just to fix this for me but if someone knows my problem and can guide me in the right direction, that would be great. Hi guys,
I wonder if you can offer any advice?
I have two user database tables that are about 70% identical. The problem is that with one of them, the phone number for each user has been cut short by two digits (it was an error on my part early on in the database design).
What I need to do is to get the values from both tables and put them into separate arrays then compare the arrays in a loop. If, say, the first five digits of the phone number in each row of the first table match one entry in the second table then update the second table with the phone number (the full length one).
I'm about puzzled about how to approach this, I've still got a lot to learn about array functions, it seems like it should be fairly simple but I'm a bit lost as to where to begin.
Any advice would be massively appreciated!
This has kept me busy for a couple of hours. I have two arrays that I would like to compare against each other to see matches and otherwise. Simple enough, right? foreach ($array1 as $value){ if (in_array($value, $array2)) { echo $value."-FOUND<br />"; } else { echo $value."-NOT!<br />"; } } Using print_r I can CLEARLY see matches: Code: [Select] array1 = Array ( [0] => CHARLES [1] => TOM [2] => DICK [3] => HARRY) array2 = Array ( [0] => HARRY [1] => DICK [2] => TOM [3] => CHARLES) The only difference I can see is the keys - but why should that matter for what I'm trying to do? Both arrays were converted to uppercase. I have done variations of search_array, array_intersect and array_unique - but absolutely nothing is working. 3 hours later and I'm no further then I started off. WTF? hi i have to compare dates one from database and other from the loops ..if they match background color will change ... so far i have done very thing but the problem i am getting that in while loop i am getting one date to compare with all 365 days in the year ...which are coming from the loop.. i need help to solve this... <?php if (isset($emplistshow) && ($emplistshow == 'show')) { $monthNames = Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"); ?> <div class="outerbox" style=" float: left;"> <table colspan="5" rowspan="4"> <tr > <td width="18%" colspan="2"><strong>Month</strong></td> <td width="12%" colspan="2"><strong>Division</strong></td> <?php for($m=1;$m <=31;$m++) { ?> <td width="26" height="20px" align="center" valign="middle" ><?php echo $m; ?></td> <?php } ?> </tr> </table> </div> <div class="outerbox" style=" float: left;"> <table > <?php //$sql ="SELECT leave_date,leave_type_id,leave_request_it, FROM `hs_hr_leave` WHERE employee_id = $emplid "; //loop to print numbers if months in a given year for($Month=1;$Month <= 12;$Month++) { ?> <tr> <td width="18%" colspan="2"><strong><?php echo $monthNames[$Month-1]; ?></strong></td> <td width="12%" colspan="2"><strong>Division</strong></td> <?php $num = cal_days_in_month(CAL_GREGORIAN, $Month, $cYear); // 31 //$dates = date("$cYear-$Month-1"); $sql ="SELECT leave_date,leave_status,leave_comments,leave_type_id,emp_depment FROM `hs_hr_leave` WHERE employee_id = $emplid "; $res = mysql_query($sql); //loop to print numbers if days in a given month for($i=1;$i<=$num;$i++) { ///$dates = date("$cYear-$Month-$i"); $dates = date("Y-m-d", mktime(0, 0, 0, $Month, $i, $cYear)); $checkdate = strtotime($dates); //loop to print dates from database while ($row = mysql_fetch_array($res, MYSQL_NUM)) { //echo $time2=date("Y-n-j",strtotime ($row[0])).'<br/>'; //here you have to seprate the year month and day coming from db and pas it to mktime function as doing above ///like $dates = date("Y-n-d", mktime(0, 0, 0, $Month, $i, $cYear)); $status = $row[1]; $comments = $row[2]; $typeid = $row[3]; $depment = $row[4]; $dbD = date("d", strtotime($row[0])); $dbM = date("m", strtotime($row[0])); $dbY = date("Y", strtotime($row[0])); $dbuser = date("Y-m-d", mktime(0, 0, 0, $dbM, $dbD, $dbY)); $userDates = strtotime($dbuser); //echo $dbuser.'<br/>'; //echo $dates.'<br/>'; } //echo $dbuser.'<br/>'; //echo $checkdate ."==". $userDates.'<br/>'; if($checkdate == $userDates) { //echo $typeid ; $cSql = "SELECT leave_type_name,leave_color FROM hs_hr_leavetype WHERE leave_type_id = '$typeid' "; $cRes = mysql_query($cSql); while ($color = mysql_fetch_array($cRes, MYSQL_NUM)) { //echo $color[1]; //echo $color[0]; //echo $status."<br/>"; echo "<td width='26' title='".$comments."' height='20px' bgcolor='#".$color[1]."' align='center' valign='middle' >"; if($status == -1) { echo "R"; } elseif ($status == 0 ) { echo "C"; } elseif ($status == 1 ) { echo "PA"; } elseif ($status == 2 ) { echo "A"; } elseif ($status == 3 ) { echo "T"; } elseif ($status == 4 ) { echo "W"; } elseif ($status == 5 ) { echo "SH"; } echo "</td>"; } } else { echo "<td width='26' height='20px' align='center' valign='middle' >".$i."</td>"; } } } ?> </tr> </table> I connected to a database. i want to know how i can get the value out of that field and add it to the values of another. i don't want to make any changes to the database. i just want to use the values for coding. please, if anyone knows how to do this, let me know. Hi: I'm going crazy trying to do the following: I'm making a job registration process where the user registers on one php page to the website, must acknowlege and email receipt using an activate php page, then is directed to upload their C.V. (resume) based on the email address they enter in the active page output. I then run an upload page to store the resume in teh MySQL db based on the users email address in the same record. If I isolate the process of the user registering to the db, it works perfectly. If I isolate the file upload process into the db, it works perfect. I simply cannot upload teh file to the existing record based on teh email form field matching the user_email field in the db. With the processes together, teh user is activated, but teh file is not uploaded. Maybe I've simply been at this too long today, but am compeled to get through it by end day. If anyone can help sugest a better way or help me fix this, I will soo greatly appreciate it. My code is as follows for the 2 pages. ---------activate.php------- <?php session_start(); include ('reg_dbc.php'); if (!isset($_GET['usr']) && !isset($_GET['code']) ) { $msg = "ERROR: The code does not match.."; exit(); } $rsCode = mysql_query("SELECT activation_code from subscribers where user_email='$_GET[usr]'") or die(mysql_error()); list($acode) = mysql_fetch_array($rsCode); if ($_GET['code'] == $acode) { mysql_query("update subscribers set user_activated=1 where user_email='$_GET[usr]'") or die(mysql_error()); echo "<h3><center>Thank You! This is step 2 of 3. </h3>Your email is confirmed. Please upload your C.V. now to complete step 3.</center>"; } else { echo "ERROR: Incorrect activation code... not valid"; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> <title>Job application activation</title> </head> <body> <center> <br/><br/><br/> <p align="center"> <form name="form1" method="post" action="upload.php" style="padding:5px;"> <p>Re-enter you Email : <input name="email" type="text" id="email"/></p></form> <form enctype="multipart/form-data" action="upload.php" method="POST"> <input type="hidden" name="MAX_FILE_SIZE" value="4000000"> Upload your C.V.: <input name="userfile" type="file" id="userfile"> <input name="upload" type="submit" id="upload" value="Upload your C.V."/></form> </p> </center> </body> </html> --------upload.php---------- <?php session_start(); if (!isset($_GET['usr']) && !isset($_GET['code']) ) { $msg = "ERROR: The code does not match.."; exit(); } if(isset($_POST['upload']) && $_FILES['userfile']['size'] > 0) { $fileName = $_FILES['userfile']['name']; $tmpName = $_FILES['userfile']['tmp_name']; $fileSize = $_FILES['userfile']['size']; $fileType = $_FILES['userfile']['type']; $email = $_POST['email']['user_email']; $fp = fopen($tmpName, 'r'); $content = fread($fp, filesize($tmpName)); $content = addslashes($content); fclose($fp); if(!get_magic_quotes_gpc()) { $fileName = addslashes($fileName); } include 'reg_dbc.php'; $query = "UPDATE subscribers WHERE $email = user_email (name, size, type, content ) ". "VALUES ('$fileName', '$fileSize', '$fileType', '$content')"; mysql_query($query) or die('Error, query failed'); mysql_close($dbname); } ?> <center> <br/> <br/> <br/> <br/> Thank you for uploading your <?php echo "$fileName"; ?> file, completing your registration, and providing us your C.V. for this position. <br/> <br/> <br/> We will contact you if your canditature qualifies. </center> Hello, Does anyone know how to get a substrig by referencing other substrings around it? Ie, my string is the following: These are my favorite foods: <ul> <li id="1"> Pizza </li> <li id="2"> Burgers </li> <li id="three"> Hot Dogs </li> </ul> I need to get the ID of each list item, i know they will always follow "<li id=". I also need to get the text of each list item, i know they will always be before "</li>" Thanks! Ok I'm trying to select the pet with the current eggid in the url. That part works fine, but when I try to select more than one color, it gets all messed up. Because I don't know how to do it and I can't find it on the internet anywhere. Code: [Select] $sql = "SELECT * FROM pets WHERE eggid='".$_GET['eggid']."' AND color='blue' OR 'green' OR 'yellow' OR 'red'"; Does anyone know how to do that? Because whenever I put this: Code: [Select] $sql = "SELECT * FROM pets WHERE eggid='".$_GET['eggid']."' AND color='blue' OR color='yellow' OR color='green' OR color='red'"; It gets all messed up. It selects ALL the colors even if the eggid isn't the current eggid. So it displays the colors of all the pets that have those colors.. :/ EDIT: OR is this the only way I can do it: Code: [Select] $sql = "SELECT * FROM pets WHERE eggid='".$_GET['eggid']."' AND color='blue' OR eggid='".$_GET['eggid']."' AND color='green' OR eggid='".$_GET['eggid']."' AND color='yellow' OR eggid='".$_GET['eggid']."' AND color='red'"; I am having trouble sending information that was entered into a form, on the same page to the next page. I am sure i have done this a few years ago but cant find the code and cant find the answer online, hope someone can help me. My code is as follows: <form method="POST" action="https://.............. .asp "> <table> <tr> <td>Name: </td> <td><input type="text" name="clientname" /></td> </tr> <tr> <td>E-mail:</td> <td><input type="text" name="email" /></td> </tr> <tr> <td>Contact No:</td> <td><input type="text" name="telno" /></td> </tr> </table> <?php $udate = date("y-m-d H:i:s", strtotime ("+2 hour")); $uniquevalue = "$udate" . " " . "Simpay Pro"; echo $uniquevalue; ?> <br /> <input type="hidden" name="info1" value="<?php print $uniquevalue?>"> <input type="hidden" name="info2" value=$clientname> <input type="submit" value="Submit"> </form> So basically info1 is working i can see the value on the next page after its submitted, but info2 is the value of the input field. Is this possible to do it like this, or do i have to send it to another page and then to my last page that displays the values? Hi is there anyway to check a string for any instances of something like this "(3)" where the number "3" could be any integer. So basically I want to search a string for any instances of a integer in brackets "(integer)" and remove it. So my string was something like $string = "String (2) string string string (7)" function($string) output would be "String string string string" where there integers in brackets could be any number I'm trying to add ui autocomplete functionality to some fields in a form and am running into a few issues. The first is I want to be able to both add and pull multiple values from the one field. I had originally thought I could comma delimit the values and handle it that way, but it seems it's a bit more complicated than that. I've tried to explode the value but it doesn't go far enough, I think I need to find a way to refine the array down by trying to replace the comma in the code somehow. Here's my current php code: <?php //connection information $host = "localhost"; $user = "myuser"; $password = "mypass"; $database = "mydb"; $param = $_GET["term"]; //make connection $server = mysql_connect($host, $user, $password); $connection = mysql_select_db($database, $server); //query the database $query = mysql_query("SELECT cb_activities FROM jos_comprofiler WHERE cb_activities REGEXP '^$param'"); //build array of results for ($x = 0, $numrows = mysql_num_rows($query); $x < $numrows; $x++) { $row = mysql_fetch_assoc($query); $activities[$x] = array(cb_activitiesterm => $row[cb_activities]); } //echo JSON to page $response = $_GET["callback"] . "(" . json_encode($activities) . ")"; echo $response; mysql_close($server); ?> Someone else had mentioned maybe using something like this: $string="([{\"cb_activitiesterm\":\"Kicking Cats, Working\"},{\"cb_activitiesterm\":\"Web Development\"}])"; $one=str_replace("([{\"cb_activitiesterm\":\"","",$string); $two=str_replace("\"},{\"cb_activitiesterm\":\"",",",$one); $three=str_replace("\"}])","",$two); echo $three; // now you can explode it ... by commas $items=explode(",",$three); But of course the problem here is he's creating the string in the php file and adding the /'s when in reality this needs to be pulled from the database and then refined. The values are currently formatted like this: ([{"cb_activitiesterm":"Kicking Cats, Working"},{"cb_activitiesterm":"Web Development"}]) Exploding simply adds a "" around the comma so it won't work. I need it to format like this: ([{"cb_activitiesterm":"Kicking Cats"},{"cb_activitiesterm":"Working"},{"cb_activitiesterm":"Web Development"}]) My second issue is I need to be able to pass multiple values into the hidden input in the script and adding a comma/space between each value. Currently if you click another value it simply replaces the prior value with the next one. Here's my script: Code: [Select] <div id="editcbprofile"> <div id="formWrap"> <div id="activities" class="ui-helper-clearfix"> <input id="cb_activitiesterm" type="text"> <input id="cb_activities" name="cb_activities" type="hidden"> </div> </div></div> <script type="text/javascript" src="autocomplete/js/jquery-1.4.2.min.js"></script> <script type="text/javascript" src="autocomplete/js/jquery-ui-1.8.custom.min.js"></script> <script type="text/javascript"> $(function(){ //attach autocomplete $("#cb_activitiesterm").autocomplete({ //define callback to format results source: function(req, add){ //pass request to server $.getJSON("autocomplete/autocom.php?callback=?", req, function(data) { //create array for response objects var suggestions = []; //process response $.each(data, function(i, val){ suggestions.push(val.cb_activitiesterm); }); //pass array to callback add(suggestions); }); }, //define select handler select: function(event, ui) { //create formatted activity var activity = ui.item.value, span = $("<span>").text(activity), a = $("<a>").addClass("remove").attr({ href: "javascript:", title: "Remove " + activity }).text("x").appendTo(span); //add interest to activities div span.insertBefore("#cb_activitiesterm"); //add activity to hidden form field $('input[name=cb_activities]').val(activity); }, //define select handler change: function() { //prevent 'to' field being updated and correct position $("#cb_activitiesterm").val("").css("top", 2); } }); //add click handler to activities div $("#activities").click(function(){ //focus 'to' field $("#cb_activitiesterm").focus(); }); //add live handler for clicks on remove links $(".remove", document.getElementById("activity")).live("click", function(){ //remove current activity $(this).parent().remove(); //add activity to hidden form field $('[name=cb_activities]').val().remove(); //correct 'to' field position if($("#activities span").length === 0) { $("#cb_activitiesterm").css("top", 0); } }); }); </script> And then my 3rd issue is if you remove a value it needs to also remove it from the hidden input. I've tried several attempts of the remove() in the onclick function but I can't get it to remove it. Lol other than that it's cherry. Any advice on any of these would be great. This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=318312.0 Hi all, I have the following MySQL insert query: Code: [Select] $insert= mysql_query ("INSERT INTO tablename (column1,`".$EXPfields."`) VALUES ('$something','".$EXPvalues."')"); where $EXPfields is an array of table-field-names and $EXPvalues is an array of table-field-values. Now I want to write an equivalent query, but using UPDATE instead of INSERT INTO, but I don't want to write out all the field names/values separately, but again want to use $EXPfields and $EXPvalues. So something like this: Code: [Select] $update = mysql_query ("UPDATE tablename SET (column1,`".$EXPfields."`) = ('$something','".$EXPvalues."') WHERE .... "); Is this possible? If so, what is the proper syntax? Thanks! Hello All,
Being a newbie at PHP coding I'm at my wits end trying to figure out:
a) how to pull-in values from a delimeted text field (in a MySQL table) and check/select the appropriate checkboxes, based on the values that were stored in the text field,
b) how to write any changes (made by the user) back to the tables' text field.
Note that this is for an "update.php" file/process.
My "create.php" file/process uses the following HTML to display and accept the checkbox values:
<div class="control-group"> <label class="control-label">Limited Time Sale Days:</label> <div class="lts-checkboxes-container"> <label class="indent-to-the-left"> <input class='lts-checkbox' type='checkbox' name='limited_time_sale[]' value ='F'><span class='no-highlight'>Fri</span> </label> <label><input class='lts-checkbox' type='checkbox' name='limited_time_sale[]' value ='Sa'><span class='no-highlight'>Sat</span></label> <label><input class='lts-checkbox' type='checkbox' name='limited_time_sale[]' value ='Su'><span class='no-highlight'>Sun</span></label> <label><input class='lts-checkbox' type='checkbox' name='limited_time_sale[]' value ='M'><span class='no-highlight'>Mon</span></label> <label><input class='lts-checkbox' type='checkbox' name='limited_time_sale[]' value ='Tu'><span class='no-highlight'>Tue</span></label> <label><input class='lts-checkbox' type='checkbox' name='limited_time_sale[]' value ='W'><span class='no-highlight'>Wed</span></label> <label><input class='lts-checkbox' type='checkbox' name='limited_time_sale[]' value ='Th'><span class='no-highlight'>Thu</span></label> </div> </div>And the code (certainly not the best code in the world, but it works) to collect, delemit/concatenate, and save to DB is as follows: if(empty($_POST['limited_time_sale'])) { // echo("You didn't select any weekday."); $selected_lts = ''; $limited_time_sale = ''; } else { $limited_time_sale = $_POST['limited_time_sale']; $N = count($limited_time_sale); $selected_lts = ''; // echo("You selected $N DoW(s): "); for($i=0; $i < $N; $i++) { // echo($limited_time_sale[$i] . " "); if ($i < ($N - 1)) { $selected_lts .= $limited_time_sale[$i] . "-"; } else { $selected_lts .= $limited_time_sale[$i]; } } } if(!empty($selected_lts)) { $limited_time_sale = $selected_lts; }Now, I've figured out how to bring-in, and separate the stored values using the following code, however I have no idea what to do next...in order to have only the approprite boxes checked/selected (in the event that all boxes were not selected during the create stage). $limited_time_sale = isset($values['limited_time_sale']) ? $values['limited_time_sale'] : ''; $checked_lts = explode("-", $limited_time_sale);In my "update.php" file, the HTML for the forms' checkboxes is as follows: <div class="control-group"> <label class="control-label">Limited Time Sale Days:</label> <div class="lts-checkboxes-container"> <label class="indent-to-the-left"> <input class='lts-checkbox' type='checkbox' name='limited_time_sale[]' value ='F' <?php echo $lts1; ?>><span class='no-highlight'>Fri</span> </label> <label><input class='lts-checkbox' type='checkbox' name='limited_time_sale[]' value ='Sa' <?php echo $lts2; ?>><span class='no-highlight'>Sat</span></label> <label><input class='lts-checkbox' type='checkbox' name='limited_time_sale[]' value ='Su' <?php echo $lts3; ?>><span class='no-highlight'>Sun</span></label> <label><input class='lts-checkbox' type='checkbox' name='limited_time_sale[]' value ='M' <?php echo $lts4; ?>><span class='no-highlight'>Mon</span></label> <label><input class='lts-checkbox' type='checkbox' name='limited_time_sale[]' value ='Tu' <?php echo $lts5; ?>><span class='no-highlight'>Tue</span></label> <label><input class='lts-checkbox' type='checkbox' name='limited_time_sale[]' value ='W' <?php echo $lts6; ?>><span class='no-highlight'>Wed</span></label> <label><input class='lts-checkbox' type='checkbox' name='limited_time_sale[]' value ='Th' <?php echo $lts7; ?>><span class='no-highlight'>Thu</span></label> </div> </div>Attached picture shows that selected checkboxes are saved to the text field as/in the format of "F-Sa-Su-M-Tu-W-Th" - if all checkboxes/weekdays were selected....or as "Sa-M-W-Th" - if only Sat, Mon, Wed, and Thu checkboxes were selected Thanks. Attached Files checkbox-Question.png 403.99KB 0 downloads |