Jump to content

dalecosp

Members
  • Posts

    471
  • Joined

  • Last visited

  • Days Won

    8

Posts posted by dalecosp

  1. $sql = "select standards_process_id,standard_id,process_id from standards_process $whereclause $order_by;";
    
    $res = mysqli_query($db_conn,$sql);
    
    if ($res) {
       while ($row = mysqli_fetch_assoc($res)) {
          echo "<input type='checkbox' name='process' value=". $rowProcess["process_id"];
          if ($row['process_id'] > 0) echo "selected='selected'";
          echo ">" . $row['somevar'] . "<br />\n";
       }
       echo "</td></tr>\n";
    }
    
    
    I'm probably not understanding something (mean this is meant to stimulate thinking, not be a "drop-in" solution). You do need to use fetch_assoc instead of fetch_array if you want to use string indices on your arrays, though; fetch_array only returns an integer-indexed array...

     

    HTH,

  2. That's the template, as requinix says.  The template should even tell you what file to edit in order to change it.  Of course, the idea is that you'll be writing some commentary about what the file does in that space...

     

     

    <?php

     

    /*

    * To change this template, choose Tools | Templates

    * and open the template in the editor.

    */

    ?>

  3. 1.  Create a system that scours some given subset of the 'Net for something (real estate, cars, wines, single women :P, vitamins, weapons, DVD's, $whatever), categorizes them, and uploads them to (Pinterest | Ebay | Etsy | $someplace).

     

    2.  Create a system that converts vBulletin forums to IPBB or phpBB or ub.threads or $someforum ...

  4. At the risk of alienating a cousin of mine who's something of a bigwig at the above-named registrar/hosting service, I'd leave them and go to RootBSD.net without hesitation.  Their name says it all ;)

    Our business moved 3 sites there last year and I don't think we could be happier.

  5. Hello

     

     

    I have the data in the database for a client appear in the fields of input type = text ... Is it possible modification or replacement of the data within the fields to anything I want to do by the submit button replaces the data that I have typed the previous allowance in the database table? And how?

     

    I want exactly similar way when the edit data in phpmyadmin.

    like this :

     

    This review of the data code ... I want to make the update button on this page.

    $name = addslashes($_POST['dname']);
    
    $con=mysqli_connect("localhost","root","","ahmedark_depot");
    // Check connection
    if (mysqli_connect_errno())
      {
      echo "Failed to connect to MySQL: " . mysqli_connect_error();
      }
    
    $result = mysqli_query($con,"SELECT * FROM driver_info WHERE driver_name ='$name'");
    
    
    while($row = mysqli_fetch_array($result))
      {
        echo "drivername: <input type=\"text\" name=\"id\" value = \"$row[id]\"><br /><br />" ;
        echo "drivername: <input type=\"text\" name=\"driver_name\" value = \"$row[driver_name]\"><br /><br />" ;
        echo "prevent: <input type=\"text\" name = \"prevent\" value = \"$row[prevent]\"><br /><br />" ;
        echo "note prev: <input type=\"text\" name = \"note_prev\" value = \"$row[note_prev]\"><br /><br />" ;
        echo "note : <input type=\"text\" name = \"general_note\" value = \"$row[general_note]\"><br /><br />" ; 
             
      }
    
    
    mysqli_close($con);
    
    
    
    ?>
    

     

    If I'm understanding correctly, you want to make your output into an HTML form which can be submitted and make changes in the data.  If you cannot use PHPMyAdmin to do this (I'm presuming because you do not wish for WWW users to have access to PHPMyAdmin  ;D  ;D ), then you'll first need to modify your output to have "<form>" tags (which may have already been done, you do seem to have <input> tags), and then write a handler for the POSTed data.

     

    For a basic button, you need this:

     

    <input type='submit'>
    You must make sure the form has a "method" attribute of "post" and an action attribute that points to your handler script:
    <form method="post" action="myhandler.php">
    You can see what is in the post array like this:

     

    print_r($_POST);
  6. Yep, I've done that too, but that seems more of a hack to me. Besides, making the resource file a .php (or other dynamically processed file) provides a great deal more flexibility. For example, with my previous problem above, the array of options could be dynamically generated from a DB query. So, there would be no need to create a new flat-file and put it out on the server - just create a new DB entry.

    True enough, but what's the point of serving anything from cache if not to negate the need for dynamic processing?  ;D 

     

    In any event, there is no single correct solution. There are always different factors that make one solution preferable to others.

    True dat!   :happy-04:

  7. I'm not sure if you've given quite enough information to do *much* helping. :)

     

    A "unit" will be an object, then? Sounds good. And you could have a generic "Unit" class and have subclasses for inch, centimeter, yard, pound, kilogram, etc.

     

    What methods would they have? Would each have a "to_other" ("to_inch", "to_yard", "to_kilogram", etc.)?

     

    As for method="PHP_SELF" ... that's simply using the same script as both the initial form and the data handler:

    if (!$_POST) {
       show_the_form();
    } else {
       //handler code goes here
    }
    HTH,
  8. The browser was caching the file so changes were not being reflected for users who had previously accessed the page.

    $.02, just for the sake of the future reader: we do lots of caching here.

     

    Our SOP is to always update the HTML by adding a querystring to resources that are cached whenever the cached item is changed.

     

    That is, if we make changes to "general.js", the corresponding script tag in the HTML will now look like this:

     

    <script src="/js/general.js?datecode" />
    This will cause the browser to see the file as a different resource, so it won't be cached. (Better than trying to "fake out" the server/browser by changing file names to imply other types). :)
  9. Does this help you?

     

    <div class="video">
     
          <html><center>  
    <?php
    $meta_value = get_post_meta($post->ID, 'video_url', true);
    if($meta_value){
       $url = parse_url($meta_value);
       $id = 0;
       if($url['host'] == 'youtu.be'){
          $id = ltrim($url['path'],'/');
       } else if(strpos($url['path'],'embed') == 1){
          $id = end(explode('/',$url['path']));
       }
    } else {
       parse_str($url['query']);
       $id = $v;
    }
    $video_info = simplexml_load_file(‘http://gdata.youtube.com/feeds/api/videos/’.$id.’?v=1');
     
    echo '<h3>'.$video_info->content.'</h3><hr /><p><iframe width="540" height="355" frameborder="1" allowfullscreen="true"  src="http://www.youtube.com/embed/'.$id.
    '?version=3&theme=light&fs=1&rel=0&cc_load_policy=1&iv_load_policy=1&modestbranding=1" type="application/x-shockwave-flash" allowScriptAccess="always" allowfullscreen="true" width="600" height="355">
    </iframe></p><p>'.$video_info->content;.'</p>';
     
    ?>
     
    </div>
    NB: *Not* linted....
  10. "size" might not be the best choice of names for this variable, as several objects in JS have this as one of their methods.  How about this?

    function setSize() {
        if (document.getElementById('mySize').value >0) {
    var theSize= document.getElementByID('mySize').value;
            document.getElementById('btnAddToCart').options.onClick = "window.location.href='<?php echo $cart_url; ?>&s="+theSize+'";
        } else {
            document.getElementById('btnAddToCart').options.onClick = "window.location.href='<?php echo $cart_url; ?>';";
        }
    }

    Does that work?  (You will need to change your HTML, of course, as well....)
     

  11. Hi

     

    Im still learning and no I haven't.

     

    How would I do that ?

     

    I know it works in a normal php file but I was wondering if its the " around the onfocus as the other items can have ' instead

     

    Thanks

    Use Chrome, or install the Firebug extension in your Firefox browser.  Then read this.

  12. When arrays are created without assigned indexes, they are indexed by numbers, starting with zero.

    As all your arrays appear to meet this criterion, you should be able to do something like this:

     

    $ct = 0; // initialize a counter
     
    foreach($_POST['song'] as $item1){
    
      echo "Song: $item1 <br />Link 1 ".$_POST['link1'][$ct]."<br />Link 2 ".$_POST['link2'][$ct]."<br />Link 3 ".$_POST['link3'][$ct]."<br />";
      $ct++;
    
    }
    Obviously, you're probably not planning to just print out the data, but hopefully you get the idea?  
×
×
  • 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.