Jump to content

ginerjm

Members
  • Posts

    6,906
  • Joined

  • Last visited

  • Days Won

    99

Posts posted by ginerjm

  1. You should study the manual where it describes the syntax of the mail() function. Your header parm is not correct, unless your 'applicant_name' form field is inappropriately named.

     

    Going further than I have ever before, here is what you need to send:

     

    to address (of course and you have done so)

    subject (you got it)

    message body (you have the contents of 'applicant address' here)

    headers - usually the from address (you have the applicant name here)

  2. Tis better that you read the manual and Learn from your trial and error(s) than for me (or someone else here) writing it for you.

     

    Good luck and have fun. Besides if I show you how to separate out your 3 values from this string what the heck are you going to then? Have someone write the next piece of the puzzle for you? C'mon!

    • Like 1
  3. You state that it isn't sending the email. Is that because you don't receive one or because you get your error message? Would be nice to know.

     

    Debugging info for next post:

    1 - post any code you have in the proper tags for this forum such as 'code' and '/code' in square brackets

     

    2 - Show us the contents of the mail vars so we can see what you have built.

     

    3 - turn on php error checking

  4. So you were talking about output layout and not the 'handling of foreach/while'. Now it is clear.

     

    The difficulty with this is the layout. I have done this using an html table but don't remember how at the moment. Another way would be to define a div to hold the data for each column and then to output your results into the appropriate div and then just display the divs side-by-side. In your while loop keep track of which column you need to put this row's result into and then increment that counter. Read up on variable variables in the manual - they would work well for this

  5. I realize this is just a snippet but it is such a small snippet nobody here is going to be able to help you.

     

    Here's what it is doing at the moment:

     

    if some value ($check) is true you do the following:

     

    - save an item called $body into an array called $bodies

    - for each element of the $bodies array (only one so far!) you assign the element number and the value of that element to $i and $b

    - you write the contents of $b to a file name based on the current value of $i - which will be strange when $i is a zero at the beginning

    - THEN you check the contents in $b for some string write a message to something called $filename which we don't know about yet.

    - if the contents in $b are not the first string you check for another string and again write some message to another thing called $filename in a different folder.

     

    and then ???

     

    Just how do you know nothing is being written? Do you get any kind of response from this or just a blank screen? Try turning on error checking (which you should already have on) or using some echo to show what you are doing each time thru this code (something like echo "just wrote $i to $dir/$mailbox" or echo "just wrote EXPIRED contents" or echo "just wrote photo_msg contents". That should help you see what is happening. Be sure to echo out $dir and $mailbox and $file_name at some point to see what they are.

  6. You talk about 'using' the foreach and while operators but then you talk about columns. Don't understand.

     

    Those two operators allow you to easily iterate through a collection of "data" easily. Each time thru you can process one piece of that data. To show you:

     

    If you have an array of the following: $ar = array('apple', 'pear', 'peach', 'cherry')

     

    and you use a foreach on it like this: foreach ($ar as $a)

     

    then the code you follow that statement with would operate on $a and you could do something like:

     

    foreach ($ar as $a)

    echo $a."<br>";

     

    Or if you had an array like $ar = array('val1'=>12, 'val2'=>15,'val22'=>22, 'val33'=>29)

    you could do this:

     

    foreach ($ar as $k=>$v)

    echo "Item $k contains $v<br>";

     

    and the output would look like:

    Item val1 contains 12

    Item val2 contains 15

    Item val22 contains 22

    Item val33 contains 29

     

    The while loop is a bit different in that it works well on arrays of arrays (imho). Usually when retrieving a set of query results as an associative array (or numeric too) you would do this:

     

    $q = 'select firstname, lastname, street1, city, state,zip from address_table where city='Albany'";

    $qresults = $pdo->query($q);

    while ($row = $qresults->fetch(PDO::FETCH_ASSOC)

    {

    echo "{$row['firstname']" {$row['lastname']} lives at {$row['street1'} {$row['city']} {$row['state']} {$row['zip']}<br>";

     

    which would echo each row of the query results on a single line of your screen.

     

    As you can see the two operators work on whatever data you give them, so your question about "adding columns" doesn't seem relevant here.

     

    Hope this helps.

  7. Not sure but there is one thing that should change.

     

    The following should change:

    ..
    ..
    
    $stmt->execute();
    $row = $stmt->fetchAll();
    if($stmt->rowCount())
    {
    if($row['rank'] == 1)
    ..
    ..
    

     

    to this:

     

    $stmt->execute();
    if($stmt->rowCount())
    {
    $row = $stmt->fetch();
    if($row['rank'] == 1)
    ..
    ..
    

     

    Note the use of rowcount to determine what to do next and also the use of 'fetch' instead of fetchall. Fetchall will produce an array of rows whereas you only want one row of data to work with here (and should have only one row).

     

    If all you want to do is to exit this script and go somewhere else, why the meta echo? Just call header("Location: $url") to go where you want.

  8. Can you show a more complete example? So many things that we don't know about in your current ex.

     

    The html? The capture of the input? The whole sequence of that and the query and THEN the check, altho you really don't need a check if you do this correctly.

  9. Do you really think that people here are going to go thru all that code?

     

    Do some debugging and isolate where your first problem occurs. Then fix it. Then move on the next problem. Use debugging methods like echoing out values to confirm that what you think s/b happening is what is happening. That's how it's done.

     

    And when you do find an error that you need help on - post THAT code here, not somewhere else. I, for one, won't look elsewhere for code that people link us to. Just not my thing.

     

    First tip tho- read my signature.

  10. Why not use php to handle the form input and generate the email instead of letting the users supply the 'to' address? Your script can do all the validation necessary and then it can send the email to whatever address you want it to go to - already verified.

  11. Do a query to retrieve the user's name fields. Start the body variable with the "Hi (name_field),\n\n" and then add more text to that message body.

     

    PS - You really should be using a different sql interface since MYSQL_* functions are all DEPRECATED. Please refer to the manual if you don't believe me. IMHO - you should learn PDO.

  12. How about doing some echo-ing of your random number to be sure that is what is happening.

    Plus - what happens in reloadpage()? Do you reset activeBattle from the value of active in your table that you just updated?

  13. Each element of your array contains a comma separated string of 'key=value' items.

     

    1 - explode each array element into an array using the comma as the separator.

    2 - foreach element of this new 'exploded' array do another explode on the = sign and echo out the second element of this new array.

  14. The way to keep from losing your inputs is to use php vars in the value clauses of each input element, hidden or visible. Grab each input value and store it in a php var that is used in the html tag so that when the form is sent back to the client those values are output.

     

    Sample:

    echo "<input type='text' name='street' value='$street'>"

     

    where $street is captured during the form receipt by the script:

    $street = $_POST['street'];

  15. Your code is the worst thing I've ever seen posted here. Of course it won't work!

     

    That said - just what are you trying to do here? Why would you want to send your users to THREE sites at the same time? Whatever is the point of that? And just how are you going to present these sites to the client? Three separate tabbed windows in your browser? Great! I'm happily browsing along and you have this link that I click on and suddenly my browser explodes with stuff! Or as was suggested, you use a JS function (I hope you can write js functions better than you attempted to write a php one!) that will pop up 3 new windows (users just LOVE when that happens!) over the existing window. Is that what you are picturing?

     

    Yes - this is harsh, but really - think about what you are proposing.

  16. Do your trains/buses have intermediate stop? Or do they simply go from Bagan to Yangon without stopping anywhere in the middle? If so you need to be able to identify the train that they need to get on.

     

    Do you have to concerned about how many seats are available for any bus/train? If so you need to keep track of how many tickets have been sold for each train/bus

     

    Things to think about.

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