0

I'm doing a one page site.
At the top of the page I have a fixed position header with logo, menu etc.

As it stands now, when I click on a menu link to take me to the relevant section it takes me there ok but as the header is fixed position the section starts at the top of the page under the header.
Is there a way to get the section(div) to start about 7rem from the top? My header is 5rem so 7 should be good.

0

I've been using thisJQuery code to fade in divs (all of the same class .showme)
But what I would like to do is fade out the previous div as the next one fades in.
Can anyone offer assistance on this?

    $(document).ready(function() {
       /* Every time the window is scrolled ... */
       $(window).scroll( function(){
         /* Check the location of each desired element */
         $('.showme').each( function(i){
           var middle_of_object = $(this).position().top + $(this).outerHeight() / 2;
           var middle_of_window = $(window).scrollTop() + $(window).height() /2;
           /* If the object is completely visible in the window, fade it it */
          if( middle_of_window >= middle_of_object ){
            $(this).animate({'opacity':'1'},2000);
          }
         }); 
       });
     });
0

I'm trying to use fullPage.js but its only ever showing my first section!
I have my sections set up like this

      <div class="section">
        Section 1
      </div>
      <div class="section">
        Section 2
      </div>
      <div class="section">
        Section 3
      </div>

and I inatlize like this

  <script>
     $(document).ready(function() {
       $('.wrapper').fullpage({
         sectionsColor: ['blue', 'red', 'green'],
        });
     });
   </script> 

Can anyone see why it would only show the first section?

Thanks in advance

0

Thanks for the reply

I now have this

@media (min-width: 1100px) and (max-width: 1260px){
.rightside{display:none;}
.rightsidebelow1260{display:block;}
.maininfo{width:95%; margin: 0 auto;}
.vseperator1{display:none;}
.hseperator1{display:block;}
}

I want these styles applied if screen width is over 1100px and below 1260px. But, for some reason they are applie if screen width is over 1260px!

0

Hi
I'm using whatsmy.browsersize.com to get my browser size for adding mediaquries to my css files.
For some reason when i write a media query for max-width: 1229px the query gets applied at 1350px!

I'm writing my queries like this

@media screen and (max-width: 1229px){
.galleries > ul > li a {padding: 0 .3rem 0 .3rem;}
}

And i have

<meta name="viewport" content="width=device-width" />

on my web page.

Can anyone see what im doing wrong?

0

I have a simple form to search a table for the search term entered into that form.

$query = $_GET['term'];
$min_length = 1;
if(strlen($query) >= $min_length){
   $query = htmlspecialchars($query);
   $query = mysqli_real_escape_string($link, $query);
}

Here the variable 'query' is the search query posted using the get method from the form.

The query for the database looks like this

$sql=mysqli_query($link, "SELECT COUNT(id) FROM products WHERE `name` LIKE 
'%".$query."%' OR `brand` LIKE '%".$query."%'
OR `description` LIKE '%".$query."%' OR `spec` LIKE '%".$query."%'
OR `category` LIKE '%".$query."%' OR `subcategory` LIKE '%".$query."%' AND status = 1 
ORDER BY id DESC") OR die(mysqli_error($link));

So this works ok if I dont paginate results, but I need to paginate them.

I think I need to get this line of code to send the query to each paginated page.

echo " <a href='{$_SERVER['PHP_SELF']}?$sql¤tpage=$x'>$x</a> ";

This gives me this error

'Catchable fatal error: Object of class mysqli_result could not be converted to string'

'$x' is just the variable for the current page

Can anyone help?

Thanks for looking

0

Still the same!
I added this error reporting to the file

error_reporting(E_ALL); ini_set('display_errors', 1);   mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);

The error that gives is:
'Fatal error: Uncaught exception 'mysqli_sql_exception' with message 'Unknown column 'apple' in 'where clause'''

0

Whats wrong with this query? For example $brand holds the value 'apple'
Then I get the error 'unknown column 'apple'

Can anyone see the problem?

if(isset($_GET['brand']) ? $_GET['brand'] : 0){
   $brand = (isset($_GET['brand']) ? $_GET['brand'] : 0);
   $sql = mysqli_query($link, "SELECT COUNT(id) FROM products WHERE brand = $brand  AND 
                       status = 1 ORDER BY id DESC")
    OR die(mysqli_error($link));
0

Ok,I havent a clue how to do this. I have a mysql table for products, each has id as the primary key.
I have an admin page where I upload products to this table or delet/hide them too.
But I want a way where when I'm uploading the products to the table I can pick 2 or 3 other products from the table so I can put them as avalible options in the product listing.

For example the product listing is for a remote control car, there would be a checkbox underneath for adding 4AA batteries to the order.

I hope I made that clear?

Can anyone help me on this?

Thanks
Glen

0

I have a form for adding products and their detail to a mysql db. I have another form that shows the products where I can remove the product from the db, I can also hide or show the product in the website.

I need to be able to edite the product details too. Is there any way that when I choose to edit a products I can get it details to appear in the first form again? The form is for adding details so can it be used to edit them too?

This is my code for first product adding form.

<form class='productsaddform' action='productsadd.php' method='post' enctype='multipart/form-data' name='image_upload_form' id='image_upload_form'>
                <?php
                   include '../inc/categorydropdown.php';
                    ?>
                   <span class='formheading'>Add Product</span><br /><br />
                   <p><b>Choose Image</b><br /><input name="image_up />
                   <br />
                   <b>Brand</b><br /><input type=text name="abrand" /><br />
                   <b>Code</b><br /><input type=text name="acode" /><br />
                   <b>Description</b><br /><textarea rows="12" cols="40" name="adescription"></textarea><br />
                   <b>Product Spec</b><br /><textarea rows="12" cols="40" name="aspec"></textarea><br />
                   <b>Price</b><br /><input type=text name="aprice" /><br />
                   <p><label for="cat">Category</label>
                   <select name="cat" id="cat">
                      <?php echo $op;?>   
                   </select><br />
                   <label for="subcat">Subcategory</label>
                  <select name="subcat" id="subcat"> </select></p>
                  <br />
                  <br />
                  <input type='submit' id='submit' name='submit' value='Add Product' />
                  <input type='hidden' value='new' /><br />
                 <?php include '../inc/add_products.php'; ?>

            </form>

This is my second form, where i can clicked edit on a product

<form class='productsremoveform' action='productsadd.php' method='post'>
            <?php include '../inc/categorydropdown.php'; ?>
            <?php include '../inc/remove_products.php'; ?>
            <span class='formheading'>Remove/Hide/Show Products</span><br /><br />
            <p><label for="cat">Category</label>
            <select name="cat" id="removecat"> <?php echo $op;?> </select><br />
            <label for="subcat">Subcategory</label>
            <select name="subcat" id="removesubcat"> </select>
            <input type='submit' name='show' value='Show' /> </p>
            <?php
               include '../inc/connect.php';
                  if(isset($_POST['show'])){
                  $subcat = ...
0

Hi,

I'm using a shopping cart js plugin called simplecart. Im having trouble getting a tumb of the product image to appear with the product info in the cart.

This line gets the full sized image to appear in the cart

<img src='$file' class='item_thumb' alt='{$row['name']}' />

Does anyone know how to get a thumb to display in the cart instead?

0

I have a dropdown box to choose topics from a discussiob board so i can then view all the replies for deletion etc.

At the minute when I choose a topic i then press a submit button and get all the answers. But is there any wayt i could have it so that the answers just get displayeds depending what is shown in the dropdown box?

This is my code to populate the dro[pdown.

 <?php
          '../inc/connect.php';
   //populate form dropdown box
   $op = '';
   $r = "SELECT id, topic FROM forum_question ORDER BY id";
   $result = $link->query($r);
   if (mysqli_num_rows($result)){
      $comment = 0;
if(isset($_POST['comment'])) $comment = (int) $_POST['comment'];
 while ($d = mysqli_fetch_assoc($result)){
     $sel = ($comment == $d['id']) ? " selected='selected' " : '';
     $op .= "\n\t<option value='{$d['id']}'$sel>{$d['topic']}</option>";
  }
   }
?>

And this is my form that contains the dropdown and shows the answers

<form class='form2' action='forumadminpage.php' method='post' enctype='multipart/form-data'>

                  <b><span class='formheading'>Choose A Topic</span><br />To Remove Comments</b><br />
                   <select name="comments">
                      <?php echo $op;?>
                   </select>
                   <input type='submit' name='submit' value='Get Comments' />
                   <?php
                   include '../inc/connect.php';
                   if(isset($_POST['submit'])){
                   $comments= intval($_POST['comments']);
                   $data = mysqli_query($link, "SELECT * FROM forum_answer WHERE question_id IN ($comments) ")
                     or die(mysql_error());
                     while($info = mysqli_fetch_array( $data )) { 
                        echo "<p>";
                        echo "<input type='checkbox' name='remove[{$info['id']}]' value='Remove' />";
                        echo $info['id'];
                        echo ':   ';
                        echo $info['a_title'];
                        echo "</p>";
                     }
                     echo"<input type='submit' name='submit' value='Delete Comments' />";
                     }

                   ?>

                   </form>

Thanks for looking........

0

I have 2 tables for a simple massage board, one for questions and one for answers.
The table forum_questions has a field called 'reply' with holds an int value for the number of answers the question has.

My problem is this:
I have a form to delete answers, you pick the question from a dropdown and the answers to that question are displayed with checkboxes for deletion. This works ok, but I'm stuck at how I then get it to decrement the 'reply' fiel in forum_question by the amount of answers that werwe removed.

This is my form

<form class='form2' action='forumadminpage.php' method='post' enctype='multipart/form-data' >

                  <b><span class='formheading'>Choose A Topic</span><br />To Remove Comments</b><br />
                   <select name="comments">
                      <?php echo $op;?>
                   </select>
                   <input type='submit' name='submit' value='Get Comments' />
                   <?php
                   include '../inc/connect.php';
                   if(isset($_POST['submit'])){
                   $comments= intval($_POST['comments']);
                   $data = mysqli_query($link, "SELECT * FROM forum_answer WHERE question_id IN ($comments) ")
                     or die(mysql_error());
                     while($info = mysqli_fetch_array( $data )) { 
                        echo "<p>";
                        echo "<input type='checkbox' name='remove[{$info['id']}]' value='Remove' />";
                        echo $info['id'];
                        echo ':   ';
                        echo $info['a_title'];
                        echo "</p>";
                     }
                     echo"<input type='submit' name='submit' value='Delete Comments' />";
                     }

                   ?>

                   </form>

And this is the php to remove answers

<?php
                   if(isset($_POST['remove'])){
                         $chk = (array) $_POST['remove'];
                         $p = implode(',',array_keys($chk)); 
                         if ($sql = mysqli_query($link, "DELETE FROM forum_answer WHERE id IN ($p )")){
                          header( 'Location: forumadminpage.php' ) ;
                         }
                         else{
                      echo '<script type="text/javascript"> alert("Comments have not been removed, try again or contact site developer") </script>';
                   }
                   }
                   ?>

Can anyone help here?
Thanks...

0

I have file that is supposed to pass the id of a link to using the ajax post method to a php file so that a div on my webpage updates. But nothing happens so i think the class is not being passesd. Can anyone see the problem.

blog.js

$('a.bloglink').click(function(e) {
    // first stop the link to go anywhere
    e.preventDefault();
    // get the class of the link
    var linkClass = $(this).attr("class");
    //get the text of the link by converting the clicked object to string
    var linkText = new String(this);
    // the value after the last / is the category ID
    var categoryValue = linkText.substring(linkText.lastIndexOf('/') + 1);
    // put the post parameters into 'params' to pass through the AJAX post request
    var params = {};
    params[linkClass] = categoryValue;  
    // send the category ID to the showproducts.php script using jquery ajax post method
    // send along a category ID
    // on success insert the returned text into the chosen div
    $.post('../inc/blogchoice.php', params, function(data) {
        //display returned data and page links in chosen div (.blog)
        $('.blog').html(data);
    });
});

blogchoicephp

 include 'connect.php';
   if(isset($_POST['bloglink'])){
      // cast the category to integer (just a little bit of basic security)
      $id = (int) $_POST['bloglink'];
      $q = "SELECT * FROM blogs WHERE id=$id";
      $result = $link->query($q);
      // this will be the string that you will return into the product-data div
      $returnHtml = '';
      // construct the html to return
         while($row = mysqli_fetch_array($result)) {
            $returnHtml .= $row['content'];
         }
    }
   // display the html
   echo $returnHtml;

Thanks for looking..........