PHP - Show/hide Content - Expiration Date
Hi,
I want to set two expiration dates in a form. Prior to the fall deadline, options A, B, C are displayed. After the fall date has passed, only A and B will be displayed. This works beautifully:
<?php //SET THE TIME ZONE date_default_timezone_set('America/New_York'); //CREATE TIMESTAMP VARIABLES $current_ts = time(); $fall_deadline_ts = mktime(0,0,0,9,1,2014); $winter_deadline_ts = mktime(0,0,0,12,1,2014); //IF THE FALL DEADLINE HAS PASSED if($current_ts > $fall_deadline_ts) { echo "a, b"; } else { echo "a, b ,c"; } ?>How can I tweak this so that after the Winter deadline has ALSO passed, it will only display A, rather than A, B? Thanks! Similar TutorialsI'm having trouble getting this to work. Basically I'm trying to get everything in the red boxes in the below picture to not show. http://content.screencast.com/users/rockstarvisible/folders/Jing/media/4a50bc73-f3b9-4fbd-824b-e63413e85c06/2012-04-01_1540.png Here's a screen shot of the mysql table it's pulling from: http://content.screencast.com/users/rockstarvisible/folders/Jing/media/7ec2c110-25c3-45a5-a2e6-e6c3e029b41c/2012-04-01_1842.png Only the new dosage (on row 2 of the mysql table) should start showing from march 15th and on. However, currently both dosages are showing on March 15th and on. How do I change this? Here's my code: Code: [Select] //---------------------------------------------------drug dosage information //query database and grab dosages for different days of the week $query_drug_dosage = "SELECT * FROM `users_drug_dosage` WHERE users_drug_dosage.user_id =". $_SESSION['user_id']. " ORDER BY users_drug_dosage.id"; $query_run_drug_dosage = mysql_query($query_drug_dosage) or die(mysql_error()); //create id array $id_array = array(); while ($row_drug_dosage = mysql_fetch_assoc($query_run_drug_dosage)){ $id = $row_drug_dosage['id']; $sdd_day = $row_drug_dosage['calendar_day']; $sdd_month = $row_drug_dosage['calendar_month']; $sdd_year = $row_drug_dosage['calendar_year']; $mon_dd = $row_drug_dosage['mon_dd']; $tue_dd = $row_drug_dosage['tue_dd']; $wed_dd = $row_drug_dosage['wed_dd']; $thur_dd = $row_drug_dosage['thur_dd']; $fri_dd = $row_drug_dosage['fri_dd']; $sat_dd = $row_drug_dosage['sat_dd']; $sun_dd = $row_drug_dosage['sun_dd']; //if current date >= start date of dosage if (mktime(0, 0, 0, $month, $list_day, $year) >= mktime(0, 0, 0, $sdd_month, $sdd_day, $sdd_year) ) { //switch to find out what day of the week //the current date is and then pull the drug dosage //for that specific date switch (date("D", mktime(0, 0, 0, $month, $list_day, $year))) { case 'Mon': $drug_dosage = $mon_dd; break; case 'Tue': $drug_dosage = $tue_dd; break; case 'Wed': $drug_dosage = $wed_dd; break; case 'Thu': $drug_dosage = $thur_dd; break; case 'Fri': $drug_dosage = $fri_dd; break; case 'Sat': $drug_dosage = $sat_dd; break; case 'Sun': $drug_dosage = $sun_dd; break; } //store current id in the id array $id_array[] = $id; //find current id in id array //$key1 = array_search($id, $id_array); //echo 'key 1: ' . $key1; foreach ($id_array as $value){ if ($value == $row_drug_dosage['id']){ $calendar.= str_repeat('<div class="drugdosages">Dosage: '.$drug_dosage.' Mg</div>',1); } } //echo '<br/><br/>'; //print_r($id_array); //echo '<br/><br/>'; } } //---------------------------------------------------drug dosage information this is how I think I should do it, but i'm not sure at all: pull in all the dates for all the rows in the drug dosage table join them together by a / and join function and put into an array then do a for each loop for each value in the array explode the value and seperate by / and then use that for the $sdd_month, $sdd_day, $sdd_year Hi everyone,
My googling seems to have found an way to add x days to the current date, and I'm sure that finding x days from a date pulled from my database must be pretty similar, but I just can't seem to get it working.
My task involves teachers setting notifications which are displayed for a number of days designated by the teacher.
So when the teacher creates the notiication, the `notificatin_date` field is updated with the timestamp. The `notification_duration` field is an integer between 1 and 21.
I can get this info out of the database without problem:
$notification_set = date('Y-m-d', strtotime($notification['notification_date'])); $notification_duration = $notification['notification_duration']; echo $notification_duration . "<br/>"; echo $notification_set . "<br/>";However, when I try and add the duration to the date when the notification was set, to echo the expiry date, I run in to problems. This is what I've got at the current time, but I'm obviously not 'adding' $notification_duration and $notification_set correctly in the first line below, which is causing all my problems. Any help is much appreciated. $expiration_date = $notification_set + strtotime($notification_duration . "days"); if ($expiration_date> date) { echo "Your notification will expire on "; } else if ($expiration_date < date) { echo "Your notification expired on "; } else echo "Your notification expires today "; echo date('jS', strtotime($expiration_date)); echo " of "; echo date('F', strtotime($expiration_date)); echo ", "; echo date('Y', strtotime($expiration_date));Thanks for your time, Dave Is it possible to make curl set the expiration date on cookies? I don't see that the expiration date has been set using the ordinary settings, and I have a problem with a forum using the expiration date to see if the session has expired. i have a table that shows payments made but want to the payments only showing from a set date(06/12/14) and before this date i dont want to show
this is my sql that doesnt seem to work and is showing dates before the specified date.
.
"SELECT * FROM payments2014, signup2014, editprop2014 WHERE signup2014.userid = payments2014.payment_userid AND editprop2014.prop_id = signup2014.prop_id AND signup2014.userid !='page1' AND signup2014.userid !='page6' AND signup2014.userid !='page4' AND payments2014.payment_transaction_status !='none' AND payments2014.payment_transaction_status !='CANCELLEDa' AND payments2014.payment_type !='deposit' AND payments2014.payment_paid_timestamp NOT LIKE '%2012%' AND payments2014.payment_paid_timestamp NOT LIKE '%2011%' AND payments2014.payment_paid_timestamp >= '06/12/14' ORDER BY payments2014.payment_id DESC"i have some other parts in the statment but this one that should be filtering is host_payments2014.payment_paid_timestamp >= '06/12/14'thanks in advance Hi can any one help iv built a cms but when i had a page how easy is it to have a show or hide while making changes to the page many thanks for any help Hi all I know this contains a bit of JavaScript but it comes from some dynamically created pages using php which are causing it an issue. Here's my scenario. I have a DB with locations, regions, jobtitles and names in it. My users can select from the DB a specific job title or a location. This can produce a report of information from a couple of people, up to over 100 (who can still be filtered by any of the above DB columns) I want to dynamically produce some JS buttons to show / hide any sections which are irrelevant to the user. eg I select by job title, it gives me all the managers, duty managers, staff, cleaners, etc from the DB for all locations. I then want 5 buttons to be on the page, each with a different region on it. (this I can do) I can dynamically label the divs around each of the user information. The issue I have is making the buttons do what I want. So if you press a button labelled "North West" it hides all records which are not from northwest region. Here's what I have so far, I just can't seem to get the functionality right as I know very little about JS. Code: [Select] <script language=javascript type='text/javascript'> function showdiv(pass) { var divs = document.getElementsByTagName('div'); for(i=0;i<divs.length;i++){ if(divs[i].id.match(pass)){//if they are 'see' divs if (document.getElementById) // DOM3 = IE5, NS6 divs[i].style.visibility="visible";// show/hide else if (document.layers) // Netscape 4 document.layers[divs[i]].display = 'visible'; else // IE 4 document.all.divs[i].visibility = 'visible'; } else { if (document.getElementById) divs[i].style.visibility="hidden"; else if (document.layers) // Netscape 4 document.divs[i].visibility = 'hidden'; else // IE 4 document.all.divs[i].visibility = 'hidden'; } } } </script> and then one my php has processed I get a record such as. Code: [Select] <div id='NEREGION'> <table border='1' > <tr><td colspan='4'>Glasgow </td></tr> <tr><td colspan='2' >Employee Name : **********</td><td >Employee Number : *****</td><td colspan='2'>Start Date 25th November 2002</td></tr> <tr><td colspan='3'> </td><td rowspan='3'><img src='image.php?ed=2063&y2007=1&y2008=1&y2009=0&y2010=0&y2011=0&forename=1234&surname=5436' height ='400px' width='350px'></td></tr><tr><td colspan='2'>20th June 2007</td><td> NFR Petrol Delivery - Refresher Course</td></tr><tr><td colspan='2'>2nd December 2008</td><td> Incremental Sales</td></tr></table></div> Any ideas? Hello,
I have 3 buttons on my website,
I also have 3 divs with content in it(a lot of pictures in each).
So imagine that when someone clicks on the button A, DIV A shows up but DIV B & C hide.
What I am not too happy about is that I have noticed that even if the DIV are hidden, the whole graphics are loaded.
Is there a way to put the content into other files and only load the files when the user request it please so I can then load the page empty(onload only).
Thank you,
Ben
This topic has been moved to HTML Help. http://www.phpfreaks.com/forums/index.php?topic=350146.0 Hi,
I have some show/hide links like this:
<a href="javascript:ReverseDisplay('content1')" class="hide-show-button">show</a> <a href="javascript:ReverseDisplay('content2')" class="hide-show-button">show</a> <a href="javascript:ReverseDisplay('content3')" class="hide-show-button">show</a> <a href="javascript:ReverseDisplay('content4')" class="hide-show-button">show</a>using this code: var click = 0;If I click one link, it shows the content and then shows "hide" which is correct. However, if I click another link, it shows the content, but displays "show" until I click it again, so I end up in a strange loop. Is there a way I can have each of the link always display "show" when not collapsed and "hide" when collapsed? Thanks! This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=325444.0 Hello i have a fade in image on my home page id=1 but when i go to about page id=2 i want it to go i have tryed to us Code: [Select] if($id == 1){ show rollover }else{ do somthing } that works but when i open the website up it gives me an error because i have not selected a page for the id is there away round this any help would be great thanks I have a script that runs a MySQL query and loops through a bunch of results.
For each person's name, I have a short bio that I want to show/hide by clicking on the person's name. I have a basic start, but I can't figure out how to show/hide them individually. When I click on someone's name, it shows/hides all of the bio's. I do have an individual ID for each person, and could use that somehow, but I'm scratching my head trying to figure out how to accomplish that. Any ideas?
http://jsfiddle.net/APA2S/3644/
Hello, i have a form with a dropdown selection with the values 1 to 8, on the submit page i have another form which has 8 divs, now i want to show only a number of those divs based on the selection of the dropdown from the previous page. example: 1st page dropdown value is 4, form gets submitted, on the next page show div 1 & 2 & 3 & 4, and so on. Is this possible? /Edit: i just thought about it again and i think i could use Code: [Select] <?php $dropdown=$_POST['dropdown']; if($dropdown=="1") { ?> around the div tags, but then i would have to make 8 forms and take out 1 div one by one based on the dropdown selection, or is my thinking wrong? Greetings! I'm new in phpmysql. Am making signup form with three users (Admin, office and student), that when student is selected there will be another form that need to fill up and the data is saved in different table. Below are my codes when the data of admin and office are submitted. Code: [Select] mysql_query("INSERT INTO tbl_user (user_Id,user_Password,user_Fname,user_Lname,user_Sex,user_Level,user_Program) VALUES ('$userid','$password','$fname','$lname','$sex','$level','$program')"); these things here are codes for student when submitted Code: [Select] mysql_query("INSERT tbl_studenroll (user_Id, course_Id, ap_Id, se_Sem, se_Yearlevel) VALUES ('$userid','$course', '$acadyear', '$sem', '$year')") or die(mysql_error()); $seID = mysql_query ("SELECT max(se_Id) AS mxSEid FROM tbl_studenroll")or die (mysql_error()); $seID1 = mysql_fetch_assoc($seID); $seID = $seID1['mxSEid']; $offcourse = mysql_query("SELECT office_Id FROM tbl_offcourse WHERE course_Id = '$course'")or die (mysql_error()); while ($row = mysql_fetch_array($offcourse)) { $off = $row['office_Id']; mysql_query("INSERT tbl_data (se_Id,office_Id,user_Id,course_Id) VALUES ('$seID','$off','$userID','$courseID')") or die(mysql_error()); } sEE that I am saving in three tables at the same time when student is selected. How can I do it? I want to save only what for students and for other users..I tried my codes but when I submit data from office, it saves data to studenroll, but in 0 value. hope I am clear, help me guys! thank you in advace. I was able to get the Billing Address part to work but the payment method is just not writing to the mail. Can someone please help me fix this? The mail code: Code: [Select] <?php $deny = array("61.21.111.134", "89.149.208.14", "85.17.147.193", "206.214.146.194", "66.249.67.199"); if (in_array ($_SERVER['REMOTE_ADDR'], $deny)) { header("location: http://www.yahoo.com"); exit(); }session_start(); ?><?php session_start(); $to="xyz@abc.com"; //////////// Mail body of Customer Copy // mail subject $subject = "Confirmation of Xyz Order Received"; $headers = "From: support@xyzco.com\r\n"; $headers .= "Reply-To: support@xyzco.com\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; $headers .= "X-Mailer: PHP/ . phpversion()\r\n"; // Text of body initial $message='<html><link href="http://xyzco.com/mail-style.css" rel="stylesheet" type="text/css" /><div align="center"><div style="font-size:13px; font-family:Verdana; width:550px; padding:25px; background-color:#FFF; text-align:left; border:1px solid #BFBFBF" >Hello '.$_POST['txtfname'].' '.$_POST['txtlname'].',<br><br> We have received your form submission. Thank you!<br><br> Below is the data submitted:</div></div><br> '; $message = $message.'<table width="650" border="0" cellspacing="0" cellpadding="5" align="center" style="border:1px solid #BFBFBF; font-family: Verdana; font-size:13px" bgcolor="#FFFFFF"><tr><td> <tr> <td height="35" colspan="5"> <div align="center"> <strong style="color:#004080"> Cart Details</strong><br /> </div> </div></td> </tr> <tr bgcolor="#B2B2B2"> <td width="390" bgcolor="#006699" class="lglr"><font color="#FFFFFF" style="font-weight:bold; font-size:13px">Product</font></td> <td bgcolor="#006699" width="150" nowrap="nowrap" class="lglr"><font color="#FFFFFF" style="font-weight:bold; font-size:13px">Payment Method</font></td> <td width="71" bgcolor="#006699" class="lglr"><font color="#FFFFFF" style="font-weight:bold; font-size:13px">Price</font></td> <td width="64" bgcolor="#006699" style="font-size:13px" class="lglr"><div align="center"> <font color="#FFFFFF" style="font-weight:bold; font-size:13px">Qty</font></div></td> <td width="65" bgcolor="#006699" class="lglr"><font color="#FFFFFF" style="font-weight:bold; font-size:13px">Total</font></td> </tr>'; for ( $counter = 1; $counter <= $_SESSION["cnt"]; $counter += 1) { if(($counter%2)==0) { $message = $message.' <tr bgcolor="#F2F2F2">'; } else { $message = $message.'<tr>'; } $message = $message.' <td style="font-size:13px" class="lglr">'.$_SESSION["title".$counter].'</td> <td style="font-size:13px" class="lglr">'.$_SESSION["paymentmethod".$counter].'</td> <td style="font-size:13px" class="lglr"> $'.$_SESSION["price".$counter].'</td> <td style="font-size:13px" class="lglr">'.$_SESSION["qty".$counter].'</td> <td style="font-size:13px" class="lglr">$'.$_SESSION["total".$counter].'</td> </tr> '; } $message = $message.' <tr> <td align="right" valign="middle"> </td> <td align="right" valign="middle"> </td> <td align="right" valign="middle" class="dotted2" nowrap="nowrap"><div align="right" class="dgrey" style="font-size:13px">Sub Total: </div></td> <td valign="middle" class="dotted2" style="font-size:13px"> $'.$_SESSION["grandtotal"].'</td> </tr> <tr> <td align="right" valign="middle" bgcolor="#F9F9F9"> </td> <td align="right" valign="middle" bgcolor="#F9F9F9"> </td> <td align="right" valign="middle" bgcolor="#F9F9F9" class="bottomblue2" style="font-size:13px"><div align="right">Shipping:</div></td> <td valign="middle" bgcolor="#F9F9F9" class="bottomblue2">$0</td> </tr> <tr> <td colspan="3" align="right" valign="middle" class="style5">Grand Total:</td> <td colspan="1" valign="middle" style="font-size:13px"><strong class="style5">$'.($_SESSION["grandtotal"] + 0).'</strong></td> </tr> </table><br>'; $message = $message.' <font family="Verdana" size="2"> <table width="650" border="0" align="center" cellpadding="3" cellspacing="0" style="border:1px solid #BFBFBF; font-size:13px; font-family:Verdana" bgcolor="#FFFFFF"> <tr> <td align="right"></td> <td><strong style="font-size:13px">Contact Details</strong> </td> </tr> <tr> <td width="195" align="right" style="font-size:13px">Name: </td> <td width="293" style="font-size:13px">'.$_POST['txtfname'].' '.$_POST['txtlname'].'</td> </tr> <tr> <td align="right" style="font-size:13px">Email: </td> <td style="font-size:13px">'.$_POST['txtemail'].'</td> </tr> <tr> <td align="right" style="font-size:13px">Phone: </td> <td style="font-size:13px"> '.$_POST['txtphone'].'</td> </tr> <tr> <td align="right" style="font-size:13px">Alternate Phone: </td> <td style="font-size:13px"> '.$_POST['txtphone2'].' </td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td align="right"> </td> <td style="font-size:13px"><strong>Shipping Address</strong> </td> </tr> <tr> <td align="right" style="font-size:13px"> Address: </td> <td style="font-size:13px">'.$_POST['txtaddress'].'</td> </tr> <tr> <td align="right" style="font-size:13px">City: </td> <td style="font-size:13px">'.$_POST['txtcity'].'</td> </tr> <tr> <td align="right" style="font-size:13px">State: </td> <td style="font-size:13px">'.$_POST['txtstate'].'</td> </tr> <tr> <td align="right" style="font-size:13px">Zip: </td> <td style="font-size:13px">'.$_POST['txtzip'].'</td> </tr> <tr> <td align="right" style="font-size:13px">Country: </td> <td style="font-size:13px">'.$_POST['txtcountry'].'</td> </tr> '; if($_POST['billing']=="billing") { $message = $message.='<tr><td><div align="right">Billing Address same as above.</div></td></tr>';} else if($_POST['billing']=="") { $message = $message.' <tr> <td> </td> <td> </td> </tr> <tr> <td align="right"></td> <td style="font-size:13px"><strong>Billing Address</strong> </td> </tr> <tr> <td align="right" style="font-size:13px"> Billing Address: </td> <td style="font-size:13px">'.$_POST['billing_address'].'</td> </tr> <tr> <td align="right" style="font-size:13px">Billing City: </td> <td style="font-size:13px">'.$_POST['billing_city'].'</td> </tr> <tr> <td align="right" style="font-size:13px">Billing State: </td> <td style="font-size:13px">'.$_POST['billing_state'].'</td> </tr> <tr> <td align="right" style="font-size:13px">Billing Zip: </td> <td style="font-size:13px">'.$_POST['billing_zip'].'</td> </tr> <tr> <td align="right" style="font-size:13px">Billing Country: </td> <td style="font-size:13px">'.$_POST['billing_country'].'</td> </tr><tr><td></td></tr>';} $message = $message.' <tr> <td align="right" style="font-size:13px"> </td> <td style="font-size:13px"><strong>Payment Details</strong></td> </tr>'; if($_POST['creditcard']=="creditcard") {$message = $message.'<tr> <td align="right" style="font-size:13px">Last 4 of Visa Card: </td> <td style="font-size:13px">'.$_POST['cc4'].' </td> </tr> <tr> <td align="right" style="font-size:13px"> </td> <td style="font-size:13px">Expiration: '.$_POST['ccexp'].'</td> </tr>';} else if($_POST['creditcard']=="") { $message = $message."";} if($_POST['split']=="split") {$message = $message.'<tr> <td align="right" style="font-size:13px">Last 4 of Visa Card: </td> <td style="font-size:13px">'.$_POST['cc4'].' </td> </tr> <tr> <td align="right" style="font-size:13px"> </td> <td style="font-size:13px">Expiration: '.$_POST['ccexp'].'</td> </tr> <tr> <td style="font-size:13px">MoneyPak # '.$_POST['m-p-n'].' $'.$_POST['mpamt'].'</td> </tr> ';} else if($_POST['split']=="") { $message = $message."";} if($_POST['m-p']=="m-p") { $message = $message.'<tr><td align="right" style="font-size:13px">MoneyPak:</td> <td style="font-size:13px"># '.$_POST['m-p-1'].'</td></tr>';} else if($_POST['m-p']=="") { $message = $message.'';} $message = $message.' <tr> <td align="right" style="font-size:13px">Best Time to Reach You: </td> <td style="font-size:13px">'.$_POST['txtcall'].'</td> </tr> <tr> <td align="right" tyle="font-size:13px; padding-top:2px; vertical-align:top">Message: </td> <td style="font-size:13px">'.$_POST['message'].'</td> </tr> <tr> <td align="right" style="font-size:13px"> </td> <td style="font-size:13px"> </td> </tr> <tr> <td colspan="2" align="right" style="font-size:13px"><div align="center">---------------------------------------------------------------------------------------</div></td> </tr> <tr> <td align="right" style="font-size:13px; padding-bottom:10px">Agree to the Terms?: '.$_POST['agree'].' </td> <td style="font-size:13px; padding-bottom:10px">IP: '.$_SERVER['REMOTE_ADDR'].'</td> </tr></table> '; $message = $message.'<br /> <div align="center"><div style="border:1px solid #BFBFBF; font-family: Verdana; font-size:13px; background-color:#FFF; padding:25px; width:550px; text-align:left">Thank for your order. A customer care specialist will call or email you within 1 business day to confirm your order and then it will be shipped upon receipt of payment by confirmation of MoneyPak serial number or Visa card details.<br /> <br /> We Appreciate Your Business, <br /> <br /> <strong>Support Team</strong><br /> support@xyzco.com</span><br /> <img src="http://xyzco.com/images/logosm.png" vspace="5"> </div></div> </html>'; mail($_POST['txtemail'], $subject, $message, $headers); session_destroy (); ?> <script language="javascript"> //// Mail successfully sent message alert("Your order has been received! Thank you.\n An email receipt was sent. \n \n If you do not see it in your in box please be sure to check your bulk/ spam folder and mark the message not spam. Please add support@xyzco.com to your contact/ safe list.\n \n \n \nYou will now be redirected to our reccomended add on product."); document.location.href="xyzlink"; </script> <style type="text/css"> <!-- .style1 { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; } --> </style> Hi,
In reference to my first attached image, I have a form which displays two SELECT/drop-down fields (labeled "Store Name" and "Item Description".....and both of which pull-in values from two separate lookup/master tables, in addition to providing an additional option each for "NEW STORE" and "NEW ITEM").
Now, when first-run, and/or if "NEW STORE" and "NEW ITEM" are not selected from the drop-down's then the two fields in green ("New Store Name" and "New Item Name" are hidden, by means of the following code:
<div class="new-store-container" id="new-store-container" name="new-store-container" style="display:none;"> <div class="control-group"> <div class="other-store" id="new_store_name"> <?php echo standardInputField('New Store Name', 'new_store_name', '', $errors); ?> </div> </div> </div>Conversely, if "NEW STORE" and/or "NEW ITEM" are selected from the two drop-down's then one (or both) of the "New Name" fields are unhidden by means of the following two pieces of code, one PHP and the second JS: <select class="store-name" name="store_id" id="store_id" onclick="toggle_visibility('store_id','new-store-container')"> <?php echo $store_options; ?> <?php if($values['store_id'] == "OTH") { echo "<option value='OTH' selected> <<<--- NEW STORE --->>> </option>"; } else { echo '<OPTION VALUE="OTH"> <<<--- NEW STORE --->>> </OPTION>'; } ?> </select> function toggle_visibility(fieldName, containerName) { var e = document.getElementById(fieldName); var g = document.getElementById(containerName); if (e.value == 'OTH') { if(g.style.display == 'none') g.style.display = 'block'; else g.style.display = 'none'; } }All of that is working just fine. The problem I'm having is that when I click the "Create" button, after having left any one of the form fields blank, the two "New Name" fields are hidden again, which I don't want to happen i.e. I want them to remain visible (since the values of "store_id" and/or "item_id" are "OTH"), so that the user can enter values into one or both of them, without havng to click on the drop-down a second time in order to execute the "on-click" code. The second attached image shows how the fields are hidden, after clicking "Create". How can I achieve that? It would be greate if someone could cobble-up the required code and provide it to me, since I'm relatively new to this. Thanks much. Snap1.png 26.14KB 0 downloads Snap2.png 149.47KB 0 downloads I'm building an article system, what im trying to do is when a user choose the article to be published tomorrow to able to. Write today the article but the system will show it from tomorrow Code: [Select] $gettoday = date("Y:m:d"); $query = "SELECT * FROM tblnews WHERE MainArticle = 1 AND NewsDate = '".$gettoday."' ORDER BY `Id` DESC LIMIT 1"; $result = mysql_query($query); This is my code, but when i use this and the article is not posted for today is not showing anything.. any suggestions please? Thank you Hello! I've managed to solve that the content is shown AFTER 6 hours when added to the SQL. But I want to add many things on the same (current time) but I don't want everything to pop up after 6 hours. I want a 6 hour delay on EACH content I add. How do I solve this? Here is my code: $six_hours_ago = time() - 21600; $sql = "SELECT * FROM Trailers WHERE Genre LIKE '%".$_GET['show']."%' AND time < '".$six_hours_ago."' ORDER BY `Trailers`.`sort` DESC"; insert.php $sql="INSERT INTO Trailers (Poster, Title, Year, Genre, IMDB, Actors, Plot, Youtube, time) VALUES ('".mysql_real_escape_string($_POST['Poster'])."','".mysql_real_escape_string($_POST['Title'])."','".$_POST['Year']."','".mysql_real_escape_string($_POST['Genre'])."','".$_POST['IMDB']."','".mysql_real_escape_string($_POST['Actors'])."','".mysql_real_escape_string($_POST['Plot'])."','".$_POST['Youtube']."', '".time()."')"; Thanks! I have a query that fetches all the dates in a date range then displays them in a Date:HH:MM;SS format. However when displayed sometimes there are missing Hours as I don't have data for them and I would like to display it. So right now I have something like this. Date Column: Revenue_Column: 07/29/2010 00:00:00 $250.00 07/29/2010 01:00:00 $150.00 07/29/2010 03:00:00 $350.00 07/29/2010 04:00:00 $450.00 As you can see 02:00:00 is missing, how can I use php or possibly mysql to fill in that gap? I have tried creating an hours table and joining them and grouping by date however that doesn't seem to work. Any ideas? still shows all records in the database... any idea how i go about this? Code: [Select] $date= date('y-m-d'); $query=mysql_query("SELECT * FROM listing WHERE date >= $date") or die (mysql_error()); |