SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Member
    Join Date
    Aug 2013
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Flow control based on option selected from MySql

    I have an info-card that needs to be populated with an address, date, and time. This should happen when user selects an address from the options drop down menu. As it is now, I am using PHP 5.4 to grab records from MySql, and display address as values for select options. I have the date and time showing up as content in info-window (Google map), however I also need address, date, and time to show up (one at a time, based on user selection) in info-card area (please see webstie–yardsalendipity.com

    I've given a small snippet here to give an idea of how I have things set up. I can give more on request if that's ok.
    Code samples:
    Select options
    PHP Code:
                          <select id="end" onchange="calcRoute();" class="form-control">
                            <option value="select" id="option-style">please select destination </option>
                            <?php foreach($data as $full_address) { ?>
                            <option value="<?php echo $full_address['full_address']; ?>"><?php echo $full_address['full_address']; ?></option>
                            <?php ?>
                          </select>
    HTML Code:
    (function(i, marker)
    				{
    					google.maps.event.addListener(marker, 'click', function()
    					{
    						var infowindow = new google.maps.InfoWindow({
    							content : coords[i].full_address + '<br>' + coords[i].start_date + "&nbsp;" + "THRU" + "&nbsp;" + coords[i].end_date + "<br>" + coords[i].start_time + "&nbsp;" + "TO" + "&nbsp;" + coords[i].end_time
    
    						});
    						infowindow.open(map, marker);
    					});
    				})(i, marker);
    Really appreciate any time given to look at this,
    Thanks

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,253
    Mentioned
    196 Post(s)
    Tagged
    2 Thread(s)
    I can't see what you mean. Got a zip code that will show an example?

    BTW, yard salse ?

  3. #3
    SitePoint Member
    Join Date
    Aug 2013
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Mittineague View Post
    I can't see what you mean. Got a zip code that will show an example?

    BTW, yard salse ?
    zipcode:43123

    Typo corrected, Thanks!

  4. #4
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,253
    Mentioned
    196 Post(s)
    Tagged
    2 Thread(s)
    Thanks It looks like that info is good to me.

    infocard.png

    You mean something else, or maybe a browser issue?

  5. #5
    SitePoint Member
    Join Date
    Aug 2013
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, something else. After entering the zipcode, a directions list pops up under the zipcode field. When a user picks an address from there (select destination), that is where I'd like the corresponding date and time to show up (only one). As it is now, the date and time does show up in the info window (marker), but a user may not realize they need to click on the marker to see a date and time. Therefore, I need the date and time to show up when and address is chosen. Screen Shot 2014-04-19 at 11.18.49 PM.png

  6. #6
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,253
    Mentioned
    196 Post(s)
    Tagged
    2 Thread(s)
    I see start_date, end_date, start_time and end_time in the coords array.
    Are they also in the $data array?

    If not, how is it that full_address is in both?

  7. #7
    SitePoint Member
    Join Date
    Aug 2013
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Mittineague View Post
    I see start_date, end_date, start_time and end_time in the coords array.
    Are they also in the $data array?

    If not, how is it that full_address is in both?
    Sorry, not really sure about that.


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •