0

Dear all,
I have php file which is returning result from server which are shown as group list, this result i want to pass to the dialog box as in drop-down selection, posting the code as below of group.php. I am getting php result correctly but need to integrate in dialog box code

Group.php

<?php
$serverName = "BSD-GESERVER01\SQLEXPRESS";
$connectionInfo = array( "Database"=>"master", "UID"=>"sa", "PWD"=>"sa");
$conn = sqlsrv_connect( $serverName, $connectionInfo );
if( $conn === false ) {
    die( print_r( sqlsrv_errors(), true));
}

$sql = "SELECT Group_ID FROM Test where configured = '1'";
$stmt = sqlsrv_query( $conn, $sql );
if( $stmt === false) {
    die( print_r( sqlsrv_errors(), true) );
}

while( $row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_ASSOC) )
{
   echo $row['Group_ID']."<br />";
//}

sqlsrv_free_stmt( $stmt);
?>

Html part of dialog is as under where i have some more inputs

function(map, marker) {
							$('#dialog').append('<form id="dialog'+marker.__gm_id+'" method="get" action="/" style="display:none;"><p><label for="country">Country</label><input id="country'+marker.__gm_id+'" class="txt" name="country" value=""/></p><p><label for="state">State</label><input id="state'+marker.__gm_id+'" class="txt" name="state" value=""/></p><p><label for="address">Address</label><input id="address'+marker.__gm_id+'" class="txt" name="address" value=""/></p><p><label for="Group">Group</label> [B]//PHP result should be displayed here as drop down box [/B]</p><p><label for="comment">Comment</label><textarea id="comment" class="txt" name="comment" cols="30" rows="2"></textarea></p></form>');

Thanks in advance

Edited by paddi_1: n/a

2
Contributors
1
Reply
3
Views
5 Years
Discussion Span
Last Post by qazplm114477
0

Try the following, hope it helps

1) construct the drop down properly.

$dropDown = "<select>";
while( $row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_ASSOC) ){
    $dropDown .= "<option value='{$row['Group_ID']}'>{$row['Group_ID']}</option>";
}
$dropDown .= "</select>";

//echo $dropdown

2) draw the in the markup and hide it visibly or display none, and rather than append the whole thing in javascript, do something like this

function(map, marker) {
    $("#theFormID").show();
}
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.