Jump to content

curtis_b

Members
  • Posts

    48
  • Joined

  • Last visited

    Never

Posts posted by curtis_b

  1. 1) I don't have a php environment handy, so this is completely untested.

     

    2) Assuming the number of element in $ship_methods_allowed is unpredictable, I would try something like this:

     

    $eval_string = "$result = array_intersect(";
    
    for( $i = 0; $i < count( $ship_methods_allowed ); $i++ )
    {
    $eval_string .= "$ship_methods_allowed[" . $i . "], ";	
    }
    
    //trim off last ", "
    $eval_string = substr($eval_string, 0, -2);
    
    $eval_string .= ");";
    
    eval($eval_string);
    
    //now you should have a $result variable containing the intersection
    

     

    3) Your var_dump() contradicted your explanation of what $shipping_methods_allowed contains. You should see everything in var_dump() that you expect to be in the array.

  2. wow! huge help so far!

     

    Just some final tweaking...what line of code could I have a user input text field to be uploaded into name.txt... instead of the typical '<input type="text" name="">'?

     

    I'm not sure if I understand your question, why would you need to do it differently?

     

    And, is it possible to create a different file on submit, or possibly have the submissions logged in the same file?

     

    Absolutely, if you program the script to generate a unique filename (like using the current timestamp as the filename).

     

    As for logging all submissions in one file, yeah you could routinely append one text file, but at that point I would say just use a database.

  3. chmod is how you change file/directory permissions.

     

    you can change it either through your FTP client or in a terminal/shell if you have access to the server.

     

    google chmod.

     

    In filezilla (my ftp client) I would select the directory on the server, right-click it, and select 'file attributes'. 777 is full access, that allows the php script to be able to create/overwrite files in the same directory. 

  4. and now for a much more useful answer:

     

    This is one way to create a comma seperated paragraph in a text file.

    <html><form action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST">
    <input type="checkbox" name="food">food<br>
    <input type="checkbox" name="boxes">boxes<br>
    <input type="checkbox" name="computers">computers<br>
    <input type="checkbox" name="racecars">racecars<br>
    <input type="submit" value="generate file">
    </form>
    </html>
    
    <?php
    //only proceed if the form has been submitted
    if(!$_POST)exit();
    
    //file creation
    
    // *******in order for this to work, chmod current directory to 777
    //I ended up having to chmod this php file and the name.txt file to 777, not sure
    //if that was entirely necessary.
    
    foreach($_POST as $key => $val){
      if($data){$data .= ', ';}
      $data .= $key;
    }
    
    $ourFileName = "name.txt";
    $ourFileHandle = fopen($ourFileName, 'w') or die("can't open file");
    fwrite($ourFileHandle, $data);
    fclose($ourFileHandle);
    ?>

  5. Are you actually inserting the binary data into the database or just a filename reference?

     

    I went through this problem about 6 months ago, at first we inserted the binary data into an actual database row and as the database got bigger, the performance started to suffer.

     

    We initially decided to insert into the database because the pictures were security sensitive.

     

    When your user uploads an image, it should be placed on the server and only a filename reference should be inserted to the database. For the sake of privacy,you might want to  (what we did) keep the images under the document root, and then you have to read_image() or something like that - i have a script that works, but I have to go to class now. Let me know if you want more information.

     

    Curt

  6. I had to do this for a job not too long ago. if memory serves me, you have to write a javascript function that returns true or false. then when you call the function you need to use the return statement like this:

     

    javascript..........................

     

    function validate(){

     

      //code for (if the number is good){

      return true

      }else{

      alert('error message');

      return false;

      }

     

    }

     

    html...............................

     

    onClick="return validate()"

     

    --------------------------------

     

    hope that helps - next time ask in the javascript forum

  7. your code looks fine, and you shouldn't have to worry about the .ini settings, you won't have access to it anyway on your host.

    Who will be hosting the page? Check with them to be sure that your account allows php mail(), and that it is configured properly. 
  8. jesirose is right on, in addition, it is helpful to have javascript validate the form onSubmit, and manipulate the appropriate DOM elements with error messages for any fields that do not validate, otherwise, if everything checks out > submit.

    Validation in both js and php for one form is common.

    Curt
  9. I had to do this too, create a script that could search an ever-changing fileserver on our network.

    I used ajax - you can see a demo of the app here: [font=Verdana]http://www.curtisbranum.com/portfolio/ajax.swf[/font]

    anyway, I don't have the code with me, but I'll try to remember to post it when I'm at work tomorrow. To

    speed things up, I have one script that builds a db table of all current file/folder names, so the php script is really just looking through the database table.

  10. I'm bangin my head against the wall on this one:

    SELECT * FROM 7cp.LabelOrders
    LEFT JOIN (7cp.LabelCatalog, 7cp.LabelOrders_Common, 7cp.Locations, 7cp.Serials, 7cp.LabelCatalog_Plates, 7cp.Production)

    ON (
    LabelCatalog.RevisionID = LabelOrders.RevisionID AND
    LabelCatalog.LabelID = LabelOrders.LabelID AND
    LabelOrders_Common.PO = LabelOrders.PO AND
    Locations.LocationID = LabelOrders_Common.ReceiverID AND
    Serials.Serial = LabelOrders.Serial AND
    LabelCatalog_Plates.LabelID = LabelOrders.LabelID AND
    LabelCatalog_Plates.RevDateID = LabelOrders.RevDateID AND
    Production.Serial = LabelOrders.Serial
    )

    WHERE LabelOrders.Serial = 85 LIMIT 0,1

    **The above query WORKS, but most of the data returned comes back as null when there should be data.

    Through assembling the query peice by peice, I've found out that the problem is with the LabelCatalog_Plates table. That is, if I remove that table from the join (and the relationships) the data expected comes back, yet if I include it, most columns returned (that DO have data) come back as null.

    If anyone can offer suggestions - I appreciate your help.

    Curt


  11. Hi, I've googled this issue (and searched here) and the explanation I've found is that the parent divs need to have height:100% (html,body), but that solution doesn't seem to be working for me.

    Check out the site: http://7cpco.com/beta/index.html

    and the css: http://7cpco.com/beta/css.css

    If it all fits in your screen, resize your window (to be smaller), what's happening is that when the content extends beyond the viewport, the background will not keep going, it stops before the content ends (in both FF and IE).

    Thanks for your help!
    Curt

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