Jump to content

ginerjm

Members
  • Posts

    6,906
  • Joined

  • Last visited

  • Days Won

    99

Posts posted by ginerjm

  1. Instead of apache, why not use php to first check for the file or folder and if it exists issue a header call to it, and if not put out a polite message.

     

    OTOH - why do you have users typing in their own urls in the hopes that they make a hit somewhere?  Why not give them a drop down of the available folders/files and let them choose a correct one?

  2. And you attempt to access something named 'submit' in the POST array.  You didn't assign a name= to your submit button so you have none.

     

    For future reference (your next post?) - it's a better idea to actually indicate what you want in the subject/topic you post under.  Naming your post as you did here is not much help in getting the attention you seek, other than from the curious who have the time to browse everything.  Better pinpoint a topic that you wish help on than hope for someone's curiosity to cause them to read your question.

  3. Logic seems flawed.  First - you only need to test half the value of the starting value - not the square root.  Second - once you have determine that there is no remainder from your mod test, why do you continue on with that other logic?

  4. Once the user begins the process by submitting the form and you save that info with an "id", you simply put out a form for the user to then submit images to be uploaded.  Store those images in a folder with a table that relates each image file name to the "id" in a separate table.

     

    User table with id links to

    image table with id and image file name

     

    Store all images in one folder and always look in that folder for the image file name.  Probably want to include the user "id" as a prefix to the image file name to ensure uniqueness.  When you do a query you simply join the two tables together.

     

    You don't want to store the images themselves in a table - wasteful.  Simply define a folder and just save the filename. 

  5. I have no idea what you are showing us here, but I cleaned it up in order to begin asking questions about it.

     

    echo "<p><a href='Images/rat-zodiac.jpg'><img src='Images/rat-zodiac.jpg'";
    foreach ($Array as $Sign)
    {
        echo "alt='$Sign' height='125' width='100'/>";
        echo "</a>  $Sign<br />";
        echo "<a href='" . key($Array) . "'><img src='" . key($Array);
        next($Array);
    

     

    One can use single quotes and double quotes to make things easier.  Note how I did that in your echos.

    You start by outputting an anchor tag, using an image as the visible "link" for that anchor.  But you leave the img tag incomplete and start a loop on the array to add more code to it.  Your loop takes the first array element and adds some more attributes to the img tag and  then closes the anchor tag and then outputs the current array value. Then you start a NEW anchor tag but then you lose me.  What is the purpose of "key($Array)"?  You are already looping on the array so why the next call.  And then you grab the key of an element too.

     

    Also - why would you want to turn control over to a jpg file with that anchor tag at the start of this code?

  6. Without helping you with your algorithm, I will point out your syntax errors with this:

    $Images = array("dog"=>"Image/Dog.jpg",

                               "dragon=>"Image/Dragon.jpg");

    [/php[

     

    1 - just one = sign to make the assignment

    2 - as prev mentioned the array element operator(?) is =>  NOT =<

     

    An image gallery using arrays?  Hmmm.   Wonder how that is to be used long-term.  If one really wants to create a gallery one must have a source for those images.  Perhaps a folder?  Then where do the labels come from in the array?  Or are you building the array from user input in order to eventually save it as a file or a db table?

  7. I wouldn't call Barand's code OOP.  It's the same code I use and I don't use OOP very often at all.

     

    So - it doesn't work.  Care to enlighten us as to what error you are getting or what makes you feel it is not working?  Maybe post your code so we can see what you are running.  Be sure you have php error checking turned on too!!

  8. I tried following you before, and just looked at this last post and still don't understand.

     

    How about giving us a real life example such as:

     

    Example 1:

     

    John Non1

    John Non2

    John Non3

    ...

    ...

    ...

    jane local1

    Jane local2

    Jane local3

     

     

    and show us how you want to see that output.  What you gave us now gives you this:

     

    john non1  jane local1 jane local2 jane local3

    john non2

    john non3

     

    My original interpretation of what you wanted was something like my Example 1:

     

    Non Locals:

    john non1

    john non2

    john non3

     

    Locals:

    jane loc1

    jane loc2

    jane loc3

     

    That is not what you want?

  9. Look at your script!!  YOu blindly create php vars using stuff that may or may not exist.  Then you output the email and send a success message.  Where is you logic?  Where do you even check if you have $_POST vars? 

     

    You obviously are learning, but you also are obviously not used to programming in any language.  YOu have to look at your code and know what it is doing and be sure that is what you want it to do.

     

    Start your script at the top by checking if a specific POST variable exists.  I like to use the button value that the user clicks to submit the form.  So if your submit button is named "btn" and the value of the button is 'Submit', then my first line would be :

    if (isset($_POST['btn']) && $_POST['btn'] == 'Submit')

    {

        continue with form processing and email

        build a success or failure message such as $msg = "???";

    }

    else

    {

       handle the first time thru this script of some other submit button process (Cancel or Return??)

    }

    DisplayPage();   //  call a function that displays all of my html code - the form and any messages.

    exit();

  10. What would be really nice is for the community/authors to FINALLY remove MySQL instead of having this long denouement.  Of course it has come to fruition, but many, many users do not yet run the most current version.  My hoster is currently only on 5.5 

  11. Without trying to follow your convoluted code, I wish to point out and ask one question.  You start, quite properly I believe, by getting a list of the contents of your chosed directory.  Then you start a loop on that array holding those names.  But then you re-open the dir and start plucking filenames again which you already have available to you.  Why?   Seems to me you have what you need and should be simply attaching a handle to each and renaming it if it fits your conditions.

  12. You didn't escape the " at the end of the src= string.  Try using single quotes so you don't have to escape the doubles.

    echo "<td width='100'><div align='center'><img src='http://www.brickbybricks.ca/php/images/" . $row['Color_Name'].$row['PartID'] . ".gif'></td>";
    

     

    See how the entire string is in double quotes but the attributes inside of the tags are in single ones?

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