Jump to content

lovephp

Members
  • Posts

    530
  • Joined

  • Last visited

Everything posted by lovephp

  1. no no you are getting me wrong it is the actual code you are misunderstanding me. but anyways here is the part the php $amopunt = 5; if(isset($_POST['featured'])){ $checked = "checked"; } the html <input type="checkbox" id="featured" name="featured" <?php echo $checked;?> /> (<span id="amount"> <?php echo $amount; ?> </span>) Featured this is the actual code i have no gone into database yet but once this is sorted then ill get results for <span id="amount"> <?php echo $amount; ?> </span> from database
  2. well the 5 was just and example, it could be anything like 1, 3, 6 ot 9 between these 4 numbers and yes it would be fetched from mysaql database like (<span id="amount"> <?php echo $amount; ?> </span>) Featured but the issue if how to keep the subtracted value 1 from any of those above numbers stays same even on form submit? as of now 5 for example when check the box becomes 4 but when submit form it goes back to 5 but then when uncheck the checkbox the 5 becomes 6. how to achieve this to not change? once checked and submitted until its unchecked
  3. Really appreciate it for this explanation.
  4. this following code basically does is subtract 1 form the total value <script> $(function () { $('#featured').change(function () { var currentValue = parseInt($('#amount').text()); var newValue = currentValue + ($(this).prop('checked') ? -1 : 1); $('#amount').text(newValue); }); }); </script> and you can see here inside the span there is a value 5 <input type="checkbox" id="featured" name="featured" <?php echo $checked;?> /> (<span id="amount">5</span>) Featured the issue i face is that when i submit form yes the checkbox stays checked but the subtracted value from the span gets back to 5 again all i want is the value not to changed once subtracted when box is checked and submitted form but if unchecked then yes it should again go back to 5 any help here?
  5. Exactly im not understanding how to pass on the id of post to the modal. Never mind i give up on this plan will just get it done with a expand collapse div instead.
  6. this was exactly what i wanted thank you soo much
  7. everything opens within the same page no external file is called and i tried to add this inside the foreach so that i could add post information straight away but it just wont happen this is the css part #filterSearch { left: 45%; margin: -230px 0 0 -32%; opacity: 0; position: absolute; top: -50%; visibility: hidden; width: 75%; box-shadow: 0 3px 7px rgba(0,0,0,.25); box-sizing: border-box; transition: all .4s ease-in-out; -moz-transition: all .4s ease-in-out; -webkit-transition: all .4s ease-in-out; } #filterSearch:target { opacity: 1; top: 50%; visibility: visible; } #filterSearch .header, #filterSearch .footer { border-bottom: 1px solid #428BCA; border-radius: 5px 5px 0 0; } #filterSearch .footer { border: none; border-top: 1px solid #e7e7e7; border-radius: 0 0 5px 5px; } #filterSearch h2 { background:#fff; margin: 0; color: #000; padding:4px 4px; font-weight:bold; font-size:16px; } #filterSearch .btn { float: right } #filterSearch .modal_body, #filterSearch .header, #filterSearch .footer { padding: 10px; color: #000; } .filterSearch-content { background: #fff; position: relative; z-index: 20; border-radius: 5px; color: #fff; } #filterSearch .modal_body { background: #fff } #filterSearch .overlay { background-color: #000; background: rgba(0,0,0,.; height: 100%; left: 0; position: fixed; top: 0; width: 100%; z-index: 10; } .filter_search a{ background: url("../images/filter.png") no-repeat left; color: #fff; font-weight: bolder; font-size:11px; margin:1%; padding:27px; } .modal_body a { color: #ff0000; text-decoration: none; display: inline-block; padding: 5px 10px; border-radius: 5px; } now the html <div id="filterSearch"> <div class="filterSearch-content"> <div class="header"> <h2>FILTER SEARCH:</h2> </div> <div class="modal_body"> <p>Anything you write here</p> <a href="#"> Close </a> </div> </div> <div class="overlay"></div> </div>
  8. no no this modal is complete css based when click on #contachNow the window opens up wait ill post the code how this modal works
  9. im trying to display records where hot_topic ='Yes' comes on top as in DESC order but only if created timestamp is not older than 7 days else it should not show on top how would the query be here? $query = "SELECT * FROM posts ORDER BY hot_topic ='Yes' WHERE created !< DATE_SUB(NOW(), INTERVAL 7 DAY), id DESC LIMIT :per_page OFFSET :offset"; im sure this is definitely wrong
  10. you are right im the one not clear myself what exactly im trying to do. working on it again not getting the idea how to pass the idetails to that window of maybe il think of something easier than this i guess. still appreciate you have given me ur valuable time
  11. really sorry i guess im not being able to explain it
  12. lol i did ok here is the modal part its css based <div id="contactNow"> <div class="contactNow-content"> <div class="header"> <h2>Modal</h2> <p><b>Post Info</b></p> </div> <div class="contact_modal_body"> <a href="#"> Close </a> </div> </div> <div class="overlay"></div> </div> and this is the php code which fetches all the records foreach ($result as $row) { echo '<br/> <h3>'.$row['title'].'</h3> <div class="highLight"> <p><b>'.$row['name'].'</b> <br/> <small> <b>Posted:</b> '.time_difference($row['created']).' </small> <br/> '.$desc.' </p> <a href="#contactNow" class="contactnowBtn"/>Contact Now</a> /// this is the link which opens up the modal window </div>'; }
  13. well when i click on <a href="#contactNow" class="contactnowBtn"/>Contact Now</a> a window opens up within the page and thats where i wish to add my contact form according to the records fetched from db
  14. $desc is description and result is from the mysql query. everything is working just ok just that am unable to load the results into the modal only the first result info gets inside the modal regardless clicking on other records contact
  15. well yes i forgot to remove its related to anothing if statement i just posted bit from the code as it may get lengthy
  16. am trying to make contact form inside modal but for some reason it just wont work. records are displaying ok but when i click on the modal link information only about the first record displays no matter whichever other records i click in foreach ($result as $row) { echo '<br/> <h3>'.$row['title'].'</h3> <div class="highLight"> <p><b>'.$row['name'].'</b> <br/> <small> <b>Posted:</b> '.time_difference($row['created']).' </small> <br/> '.$desc.' </p> <a href="#contactNow" class="contactnowBtn"/>Contact Now</a> </div>'; /*Load info to Modal*/ echo '<div id="contactNow"> <div class="contactNow-content"> <div class="header"> <h2>'.$row['title'].' - '.$row['id'].' </h2> <p><b>'.$row['email'].'</b></p> </div> <div class="contact_modal_body"> <a href="#"> Close </a> </div> </div> <div class="overlay"></div> </div>'; } }
  17. Shouldn't this $stmt->bind_param("i", $id); Be $stmt->bind_param("id", $id); ??
  18. sorry it was already there i missed it now found $total = $stmt->fetchColumn(); thanks
  19. bro how do i show total results displaying in total even if its paginated? i did this if(!count($result)) { echo '<p>Nothing found.</p>'; }else{ echo $result = $stmt->rowCount(); // this shows just records in the page now all in total foreach ($result as $row) { echo $row['id']; } }
  20. yes bro guess you are right but how are you guys doing it on this forum added the 301467 to the url?
  21. what i am trying to acheive is like in here this topic has url like this phpfreaks.com/topic/301467-how-to-insert-the-post-id-along/ i am also trying to add the id like 301467 to the url
  22. yes bro in db the posted id is 8 here is how i exactly tried $stmt = $db->prepare('INSERT INTO table (poster,title,mobile,email,seourl) VALUES (:(poster, :title, :mobile, :email, :seourl)'); $id = $db->lastInsertId(); var_dump('last-insert-id = '.$id); $stmt->execute(array( ':poster' => $uid, ':title' => $title, ':mobile' => $mobile, ':email' => $email, ':seourl' => ''.$id.'/'.$seourl ));
  23. i did this $id = $db->lastInsertId(); var_dump('last-insert-id = '.$id); $stmt->execute(array( ':poster' => $uid, ':title' => $title, ':mobile' => $mobile, ':email' => $email, ':seourl' => ''.$id.'/'.$seourl but still 0 gets added in db not the id an also in browser i get this printed string 'last-insert-id = 0' (length=18)
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.