Jump to content

solarisuser

Members
  • Posts

    122
  • Joined

  • Last visited

    Never

Posts posted by solarisuser

  1. Heh, I went in gung-ho about using CSS, until I realized that 1024x768 and 1280x1024 see things differently, at least the way I coded it.

     

    <div style="float: left; position: absolute; width: 150px; margin-left: 0 auto; padding: 1em; text-align:left;">
    

     

    Any problems that stick out?

     

  2. Hello All,

     

    I'm attempting to have two tables, with one being centered in the middle of the page, and one to the left of it, with in the width of 1000px (entire page has a width of 1000px).  Is there a way to have the table on the left (ie - not the table in the center of the page) exist without pushing the centered table to the right?

     

    I know CSS can do this with "position:absolute" but then different resolutions will see the table-turned-div on the left in various places, so I figure tables is the solution?

     

    Please help, I'm going nuts!!

     

    Thanks

  3. Hi All,

     

    I am trying to include a couple links inside this div...

     

    <div style="float: left; position: absolute; width: 0 auto; margin-left: 10em; padding: 0px; text-align:left;">
    

     

    The problem is that this will work in 1280x1024, but looks wrong in 1024x768, and if I tweak it for 1024x768, it looks wrong in 1280x1024.

     

    I figured I should look at "position: relative;" but I don't want these links to push the rest of the stuff on the page to the right. 

     

    Any ideas? =(

     

     

  4. Hello All,

     

    Just curious if there is a way to pass a checkbox that is NOT checked with "=> off".  This would be the opposite if a checkbox IS checked, where it is passed with "=> on".

     

    Currently, I have a search page that allows users to select a checkbox and clicks the "Send" submit button, the form saves that checkbox value to a session.  When that same search page is refreshed, that checkbox is already checked since the user selected and submitted it.

     

    The problem I am trying to tackle is how to let the user "un-check" that box, and click the "Send" submit button, and read from $_POST that it was unchecked.

     

    Any Ideas would help.

     

    Thanks

  5. <script type="text/javascript">

     

    function ShowValues()

    {

     

    checkboxes = new Array()

     

      for (i = 0; i < 4; i++)

      {

        if (document.getElementById("Box" + i).checked == true)

        {

      message = document.getElementById("Box" + i).value

      checkboxes = message

        }

      }

    document.write(checkboxes[0])

    }

     

     

     

    </script>

     

    <b>Checkboxes:</b><br/>

    <input type="checkbox" id="Box0" name="CheckGroup" value="Item 1"/>This is Item 1<br/>

    <input type="checkbox" id="Box1" name="CheckGroup" value="Item 2"/>This is Item 2<br/>

    <input type="checkbox" id="Box2" name="CheckGroup"/>This is Item 3<br/>

    <br/>

    <input type="button" value="Show Values" onclick="ShowValues()"/>

  6. ack, this was the feeling of despair I had originally when I realized it was shopping-cart style..

     

    I have a table with some text fields or dropdown fields, and when a user narrows down the critereia, they click search.  then the code in " if(isset($_POST['submit'])) " kicks in, and shows all results with pagination if over X amount of results.  Currently, I have a dynamically generated  link (e.g - checkout.php?id=123) next to each book title, but for someone checking out 20 books, it seems like a huge waste of time compared to the checkbox method.

     

    i guess the difference with this versus amazon.com's shopping cart is that amazon does not use checkboxes.  this could be good for me because I can concentrate on figuring out how to get your code to work like we originally wanted to.

     

    one idea is to use javascript or something to append the checked entries id number in the URL of each page number or "next" links.  (e.g - &checked=123&checked=456).

     

    The main problem is figuring out, once the initial page loads with the results and empty checkboxes, how to know what checkboxes have been selected if any once you click on a page number or next link.

     

    Any thoughts?

     

    BTW - I just had another idea - could I use onClick to put the value of "id=" in a session or something using JS for each checkbox field?

     

    For example, <input type=checkbox id=123 name=checkbox[] onClick="rememberCheckBox(this.form)">?

     

    I don't know any JS so I'm just guessing...

     

    yeah this part will be a little tricky. the reason it will get tricky is because sometimes, people will go back to a page that they've already checked some books. but now, let's say they want to remove some of the original books and add some different ones. well, if you simply insert the entire $_POST array into the $_SESSION array without checking, you're going to get multiple books of the same type. you don't want that. so, the trick is that every time somebody wants to 'submit' new books, or a new set of books differing from their original set into the $_SESSION, you have to write a function that will compare this new list that wants to be added with the list that already exists in the $_SESSION array. if there are matches, it should not be added.

     

    however, that brings on the question, how would i remove the books that they 'uncheck' from the form? since $_POST only stores the ones that were checked, there's no way to know if they wanted to remove one... suddenly i'm reminded of a shopping cart. you can remove items, but only if you're at a page where you can see all the contents of your cart, and choose to remove them one by one... you cannot do this from the 'browsing' page. you can only do it from the 'your cart' page. hmmm. how is the rest of your site constructed around your browse/add/remove books feature?

     

    so, i'm thinking, you add books from the browse pages. and you can remove them from another page that shows what you have listed.... hmmm... what do you think?

  7.  

    a quick example of how you would probably be constructing your checkbox form:

    <?php
            echo "<pre>". print_r($_POST, true) ."</pre>\n";
    
            $sql = "SELECT * FROM your_table;
            $query = mysql_query($sql);
    
            echo "<form method=\"post\" action=\"\">\n";
            while($row = mysql_fetch_array($query)){
                    echo "<input type=\"checkbox\" name=\"checked[]\" value=\"{$row['id']}\"";
                    foreach($_POST['checked'] as $val){ echo (($row['id'] == $val) ? (" CHECKED") : ("")); }
                    echo ">{$row['book_name']}\n";
            }
            echo "<input type\"submit\" value=\"Submit\">\n";
            echo "</form>\n";
    ?>
    

     

    now, all the boxes that were checked will be stored in an array called $_POST['checked']. the print_r($_POST) will display all the checked boxes. you can then add them to your session, or you can add them to a database. it's up to you from there. if you need any more help, let us know.

     

     

    That's awesome.  I've integrated it the way it needs to look and all is well except for one thing.  I am trying to figure out where I would use sessions (obviously I need to) with the code above, so the checked boxes will be remembered.

     

    Currently, the page numbers at the bottom of the search are <A HREF> links with a whole of bunch of &page=123&blah=123&etc=123 dynamically generated for each A HREF.  Since the id is stored in $_POST, at one point would I use sessions?

     

    Without the page numbers being part of the form and requiring the submit button, how could I pass $_POST? 

     

    Ahhh I'm confused =(

  8. Try using and serializng sessions to store the selected items. That would probably be the easiest way to store selections across multiple pages then when the script is ended just pull the selected items back out of the sessions array by unserializing them.

     

    So I should look at saving all "checked" <input type=checkbox> fields's id numbers into sessions when a page number is selected or not selected, right?

     

    Then have the submit button's code use the sessions instead of $_GET/$_POST?

     

    Just trying to wrap my head around it.

  9. Hi All,

     

    I am curious what everyone things would be the best way to tackle this...

     

    I have a book reservation system, and it paginates depending on the number of results.  I let users check a checkbox next to a record, and they can do that to as many records listed on that page.  Then they click on the submit button and it works.

     

    The problem is when the results are paginated, for example, listing 10 records out of 100 (so there are 10 pages), when the user selected a few checkboxes and clicks on another page, the previously checked records are forgotten.

     

    My goal is to have those previously checked records remembered so when the user finally clicks on the Submit button, all checked entries will be used.

     

    Thanks

  10. Hi All,

     

    I have tried various collapsible field snippets I found off the web, and none of them like it when I embed a <td>something</td> inside <div>. 

     

    The goal is to have many collapsible plus/minus images on a search page, and when a user clicks on one, I will be able to align the two <input> fields in the table it's in so its centered nicely an whatnot.

     

    Anyone know of anything like that?

     

    Thanks

  11. Hi All,

     

    I have a footer in CSS that works almost perfectly.  I can't figure out what I need to do to get a line below the text like it currently has above the text.

     

    <style type="text/css">
    #footer {
            clear: both;
            width: 98%;
            margin: 10px;
            text-align: center;
            font-family: Verdana;
            font-size: 11px;
            padding: 3px;
            border-top: 2px solid red;
            color: #000;
    
            }
    
            #footer .left {
                    float: left;
                    text-align: left;
                    }
    
            #footer .right {
                    float: right;
                    text-align: right;
                    }
    
    
    </style>
    
    <div id="footer">
    <span class=left>
    test1</span><span class=righttest2</span>
    </div>
    
    

     

    Thanks for any help!

  12. Hi All,

     

    I have this JS code that uses a checkbox to show or hide fields.  If checked, it will show the fields that are hidden by default.

     

    <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript"> 
    <!-- 
    function showHideSelection() 
      { 
       if (document.form1.gor.checked) 
        { 
         if (document.layers) 
          document.layers[\'formdiv\'].visibility = "show"; 
         else 
          document.getElementById(\'formdiv\').style.visibility = "visible"; 
        } 
       else 
        { 
         if (document.layers) 
          document.layers[\'formdiv\'].visibility = "hide"; 
         else 
          document.getElementById(\'formdiv\').style.visibility = "hidden"; 
        } 
      } 
    //--> 
    </SCRIPT> 
    

     

    Then in the PHP page, I have this:

     

    <form name="form1"> 
        <input type="checkbox" name="gor" onclick="showHideSelection();"> Toggle 
    </form>
    

     

    When I physically click on the checkbox, it shows the hidden fields.  However, when I have "checked" in that input type, like so:

     

        <input type="checkbox" checked name="gor" onclick="showHideSelection();"> Toggle 
    

     

    the checkbox is checked, but the JS code is not executed and the hidden fields are not shown.

     

    It looks as though I'm not doing something right, could someone please correct me?

     

    Thanks!

  13. It looks nice, but I can't seem to get it to work with this test page...

     

    Could you please correct me...

     

    I have <html><script> , your code, </script>, then

    <FORM NAME="myform" ACTION="" METHOD="GET">
    Enter something in the box: <BR>
    <INPUT TYPE="text" NAME="inputbox" VALUE=""><P>
    <INPUT TYPE="button" NAME="button" Value="Click" onClick="no_more_popup()">
    </FORM>
    </html>
    

     

    I figured that'd be how I'd send the "inputbox" using $_GET to the webpage I put in your code.  In that page that AJAX sends the GET, I have:

    <?
    print_r($_GET);
    ?>
    

    so I can see if the inputbox was sent, but it was not.

     

    Thanks

     

     

  14. Hi All,

     

    I want to have a checkbox that says "Do not show me this popup anymore" that when clicked, it automatically sends a MySQL query like "UPDATE .... SET no_more_popup = '1'".  This is so the user can select the checkbox and then close the popup, without having to submit a form that executes the MySQL query.

     

    I am using PHP but I think this is purely a JS thing.

     

    Does anyone happen to know of a tutorial or script that does this, or should I look at some other technology?

     

    Thanks!

  15. Hi All,

     

    Here is my current code

     

    $name2 = $data[name];
    $patterns[0] = '/\(....\)/';
    $replacements[0] = '';
    $name3 = preg_replace($patterns, $replacements, $name2); 
    

     

    Pretty much I used periods because nothing else worked, but the problem is the number of characters can be more or less than four between the brackets. 

     

    $data[name] would look like this:  Bob Johnson (Cool Guy)

     

    How can I remove everything between the brakets INCLUDING the ( and )?

     

    Thanks

×
×
  • 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.