Jump to content

jarvis

Members
  • Posts

    506
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

jarvis's Achievements

Advanced Member

Advanced Member (4/5)

3

Reputation

2

Community Answers

  1. Am no expert but perhaps something more like: <?php $looking = isset($_GET['title']) || isset($_GET['author']); $title = isset($_GET['title']) ? $_GET['title'] : 'No title set'; $author = isset($_GET['author']) ? $_GET['author'] : 'No author set'; ?> <!doctype html> <html> <head> <meta charset="utf-8"> <title>Bookstore</title> </head> <body> <p>The book you're looking for is:</p> <ul> <li><strong>Title</strong>: <?php echo $title; ?></li> <li><strong>Author</strong>: <?php echo $author; ?></li> </ul> </body> </html> Others with way more experience may be able to improve further but that should at the very least get you up and running!
  2. You have errors in your code: <?php $looking = isset($_GET['title']) || isset($_GET['author']); ?> <!doctype html> <html lang = "en"> <head> <meta charset ="UTF-8"> <title>Bookstore</title> </head> <body> <p>you looking <?php echo (int) $looking; ?> </p> <p>The book you are looking for is </p> <ul> <li><b>Title</b>: <?php echo $_get['title']; ?></li> <li><b>Author</b> <?php echo $_get['author']; ?></li> </ul> </body> </html> Is your debugging/error checking on? Once I fixed the errors in line 2 and 15, it displays but still flags the following: Notice: Undefined variable: _get in index.php on line 14 Notice: Undefined variable: _get in index.php on line 15 Your code also seemed a tad scruffy given it was a copy/paste from a book!
  3. Many thanks for your time! I'll have a play and see what I can do - thank you for the pointers...
  4. Thanks @requinix The href in the A tag already has href="#tab-reviews" This is to then jump down to the TAB section whereby the code above kicks in and opens the specific TAB. So I can't quite see how to combine the two and go the TAB section, open the specific TAB and then scroll to the section within the TAB Or am I missing something?!
  5. Morning All, I've a link on a page, which when clicked needs to open a specific TAB. The code for this works and can be seen below: jQuery(document).ready(function($){ $('a.jump-to-tab').click(function(e){ e.preventDefault(); var tabhash = $(this).attr("href"); //var tabli = 'li.' + tabhash.substring(1); var tabli = tabhash.substring(1); var tabpanel = '.panel' + tabhash; $(".wc-tabs li").each(function() { if ( $(this).hasClass("active") ) { $(this).removeClass("active"); } }); //$(tabli).addClass("active"); $('[aria-controls="'+tabli+'"]').addClass("active"); $(".woocommerce-tabs .panel").css("display","none"); $(tabpanel).css("display","block"); //$('html,body').animate({scrollTop:$(tabpanel).offset().top}, 750); if (navigator.userAgent.match(/(iPod|iPhone|iPad|Android)/)) { document.getElementById("tab-reviews").scrollIntoView(); }else{ $('html,body').animate({scrollTop:$(tabpanel).offset().top}, 750); } }); }); Ideally, what I'd like to do, is once the TAB is open, to open at a specific point i.e. where a piece of content has a specific ID, in this case #commentform I've looked around but can't seem to see anything and wonder if this is possible? Many thanks in advanced
  6. Using Bootstrap 4 cards, something like: <?php require "database/dbconfig.php"; //include_once __DIR__.'/core-php-admin/database/dbconfig.php'; $query = "SELECT * FROM users"; $query_run = mysqli_query($connection, $query); if (mysqli_num_rows($query_run) >0){ ?> <div class="container py-5"> <div class="row"> <?php foreach ($query_run as $row){ ?> <div class="col-4"> <div class="card"> <img class="card-img-top img-fluid" src="//placehold.it/500x200" alt="Card image cap"> <div class="card-block"> <h4 class="card-title">Card title</h4> <p class="card-text">Card body</p> </div><!-- /card-block --> <div class="card-footer"> Card footer </div><!-- /card-footer --> </div><!-- /card --> </div><!-- /col-4 --> <?php } ?> </div><!-- /row --> </div><!-- /container --> <?php } else { echo "No record found"; } ?>
  7. I think you would need something more like: <?php if (isset($_GET['sayfa'])) { $page_no = $_GET['sayfa']; } else { $page_no = 1; } $no_per_page = 10; $offset = ($page_no-1) * $no_per_page; $total_pages = "SELECT COUNT(*) FROM icerik"; $result = mysqli_query($conn,$total_pages); $total_rows = mysqli_fetch_array($result)[0]; $total_pages = ceil($total_rows / $no_per_page); $sql = "SELECT * FROM icerik LIMIT $offset, $no_per_page"; $result = mysqli_query($conn,$sql); while($row = mysqli_fetch_array($result)){ //whatever you need to go here } mysqli_close($conn); ?> <ul> <li><a href="index.php?sayfa=1">First Page</a></li> <li class="<?php if($page_no <= 1){ echo 'disabled'; } ?>"> <a href="index.php<?php if($page_no <= 1){ echo '#'; } else { echo "?sayfa=".($page_no - 1); } ?>">Previous Page</a> </li> <li class="<?php if($page_no >= $total_pages){ echo 'disabled'; } ?>"> <a href="index.php<?php if($page_no >= $total_pages){ echo '#'; } else { echo "?sayfa=".($page_no + 1); } ?>">Next Page</a> </li> <li><a href="index.php?sayfa=<?php echo $total_pages; ?>">Last Page</a></li> </ul>
  8. It looks like row 1 is called within your code by this line: <p><?php require "./oggi.php";?></p> So just move that below the closing </ul> Like so: <div class="container section" id="afterHeader"> <div class="row"> <div class="tabs movies"> <a class="style1">1^ SETTIMANA</a> <ul> <li><a href="#thu">GIO</a></li> <li><a href="#fri">VEN</a></li> <li><a href="#sat">SAB</a></li> <li><a href="#sun">DOM</a></li> <li><a href="#mon">LUN</a></li> <li><a href="#tue">MAR</a></li> <li><a href="#wed">MER</a></li> </ul> <p><?php require "./oggi.php";?></p> That will then swap line 1 and 2 of your image over
  9. Thanks @Barand - I didn't wish to speak out of term or be incorrect! But does help the post author as I guess some fields maybe numeric.
  10. I could possibly be wrong, but worth checking whether: $query = "insert into Borrowedbooks(uid,bid,borroweddate) values('$uid','$bid','$bdate')"; Just needs to be: $query = "INSERT INTO Borrowedbooks (uid, bid, borroweddate) VALUES ($uid, $bid, $bdate)"; I don't believe you need the single quotes around the variables you're adding. Worth tidying your code too, makes it easier to read and spot issues
  11. Should line 43 not be: if ($row[0] > 0){ Also you're missing a closing } that would pair line 29 but could be a copy/paste error
  12. Hi @Gunnyk Would something like this be a good starting point?
  13. Hi @BookSense I always come here to learn and ask others for advice. I'm always asked to show my code, what I've tried, explain why things don't work, what errors I get, what debugging I've done. etc. You mentioned you've downloaded loads of email scripts but none work. Why? What errors do you get? What did you try? You didn't share anything here for others to help. If they ALL failed, then maybe it's more server related!? I get embarrassed asking for help at times, especially when I simply don't 'get it' but it's the only way to learn and sometimes I can sense the frustration in the people trying to point out the glaringly obvious. I'm constantly trying to learn and improve. It does feel despite what appears to have been a truly terrible day, you may need to try harder! You mentioned you 'redeveloped all my other front-end software ' surely that's pretty skilled, so seems odd you can't sort the form!? Below is a very simple script - it may work, it may not. Contact Page: <!doctype html> <html> <head> <meta charset="utf-8"> <title>Contact Us</title> </head> <body> <form method="post" name="contact" action="contact.php"> Your Name: <input type="text" name="name"> Email Address: <input type="text" name="email"> Message: <textarea name="message"></textarea> <input type="submit" value="Submit"> </form> <script language="JavaScript"> var validate = new Validator("contact"); validate.addValidation("name","req","Please provide your name"); validate.addValidation("email","req","Please provide your email"); validate.addValidation("email","email","Please enter a valid email address"); </script> </body> </html> contact.php $errors = ''; $myemail = 'yourname@website.com';//<-----Put Your email address here. if(empty($_POST['name']) || empty($_POST['email']) || empty($_POST['message'])) { $errors .= "\n Error: all fields are required"; } $name = $_POST['name']; $email_address = $_POST['email']; $message = $_POST['message']; if (!preg_match( "/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/i", $email_address)) { $errors .= "\n Error: Invalid email address"; } if( empty($errors)) { $to = $myemail; $email_subject = "Contact form submission: $name"; $email_body = "You have received a new message. ". " Here are the details:\n Name: $name \n ". "Email: $email_address\n Message \n $message"; $headers = "From: $myemail\n"; $headers .= "Reply-To: $email_address"; mail($to,$email_subject,$email_body,$headers); //redirect to the 'thank you' page header('Location: thank-you.htm'); } thank-you.htm: <!doctype html> <html> <head> <meta charset="utf-8"> <title>Thank You</title> </head> <body> Thanks </body> </html> Maybe try that, if it doesn't work, try debugging it to find out why. If it's not got enough data capture fields, hopefully, it's a good starting point to develop!
  14. Is visitor a custom role? As a Wordpress user is generally only assigned one role, can you not simply do something like: #only show content to specific roles $user = wp_get_current_user(); if ( $user == 'subscriber' || $user == 'visitor' ){ // adsense code }
  15. If you create a loop for all your posts, you could then use 'get_page_by_title' within the loop. This will return the post ID. Once you have the post ID, you can then use 'update_post_meta' Obviously, it would depend what you're trying to update the custom field with. Are you not able to simply edit the post via the admin area?
×
×
  • 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.