Php dropdown menu from another file - php

I'm trying to create a state capital guessing game where a state will randomly generate and then from the dropdown list which contains all the capitals the user will have to guess the capital. Anyway, he wants us to have a separate file with an array. The file is called city_info.php and the arrays look like this
$state_capitals = array(
'Alabama' => 'Montgomery',
I'm having trouble getting the drop down list populate with all the capitals.
<?php
require_once "include/session.php";
if (!isset($session->valid)) {
header("location: login.php");
exit();
}
require_once "include/city_info.php";
/* DO NOT MODIFY THE ABOVE LINES !!!!! */
$states = array_keys($state_capitals);
$capitals = array_values($state_capitals);
$cities = array_merge($capitals, $other_cities);
sort($cities);
$params = (object) $_REQUEST;
print_r($params);
if (isset($params->guess)) {
$state_capitals = $params->capitals;
$answer = $params->answer;
$cities = $params->city;
}
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta http-equiv="Cache-Control"
content="no-cache, max-age=0, no-store, must-revalidate" />
<title>State Capital Guess Game</title>
<style type="text/css">
body {
padding: 10px 20px;
}
#logout {
position: absolute;
top: 40px;
right: 40px;
}
div {
width: 320px;
padding: 10px;
border: 3px solid black;
border-radius: 10px;
color: black;
text-align:center;
background-color:#3399ff;
display:inline-block
}
/*
More style rules
*/
</style>
<script type="text/javascript">window.onunload = function(){}</script>
</head>
<body>
<a id="logout" href="logout.php">Log out</a>
<h2>State Capital Guess Game</h2>
<form action="program.php" method="get">
<button type="submit">Start Over</button>
</form>
<!--- computational form -->
<div>
<p>What is the Capital of PA</p>
<select name="cities">
<?php
foreach ($city as $value):
?>
<option <?php
if ($value == $params->city)
echo "selected";
?>
><?php
echo $value;
?></option>
<?php
endforeach;
?>
</select>
<input type="submit" name="choose" value="Choose" />
</form>
</div>
<?php
echo $state_capitals;
?>
</body>
</html>

The way you phrase your question, this sounds like it could be homework. Many people on SO are glad to help with homework, however, some are not; so as a courtesy when asking a question about homework follow these guidelines: https://meta.stackexchange.com/questions/10811/how-do-i-ask-and-answer-homework-questions. You may already know this, but wanted to cover the basics just in case.
On to your question. I'll clean things up a bit so it's not so hard to follow the HTML/PHP. This should work if you substitute your current code:
<select name="cities">
<?php
$options = "";
foreach ($cities as $value){
$options .= '<option value="' . $value . '"';
if ($value == $params->city)
$options .= ' selected';
$options .= '>' . $value . '</option>';
}
echo $options;
?>
</select>
This way you're only switching between HTML/PHP once. Hope that helps!

Related

I got a problem with select option and value

I try to keep the value from selected options after the button is clicked.
For now, I have done this with my inputs(range,text) and it's working but I can't figure how to do this with my select option.
ADDITIONAL THINGS(you have to create them to run it)
c13ustawienia.php
<?php
$serwer='localhost';
$uzytk='root';
$haslo='';
$baza='komis';
?>
c13dane.txt
1993|Volkswagen|Passat|19000
1973|Opel|Blitz|12000
1997|Volkswagen|Passat|17000
2010|Mercedes|M5|29000
2001|Volkswagen|Passat|29000
1990|Volkswagen|Passat|23000
2018|Tesla|Super|129000
2018|sla|Super|9000
1992|Volkswagen|Passat|10000
2006|Audi|B9|74000
2009|Volkswagen|Passat|89000
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Baza</title>
<style>
table {border-collapse: collapse;}
td,th {border: 1px blue solid;}
th {background-color: azure;}
.id {width: 20px; text-align: center;}
.mar {width: 90px;}
.mod {width: 70px;}
.rok {width: 40px; text-align: right;}
.cena {width: 50px; text-align: right;}
.zolty {background-color: yellow;}
.pomar {background-color:orange;}
[type=text] {width:60px;}
header {height: 60px; background-color:greenyellow;}
header>img {height: 75%; text-align: center;}
nav {height: 400px; width: 30%; background-color:khaki;
float: left;}
main {height: 400px; width: 70%; background-color:moccasin;
float: left;}
footer {height: 40px; background-color: powderblue;
clear: both; text-align: center; color:blue;}
</style>
<script>
function wartosc() {
min=document.getElementById('cmin');
max=document.getElementById('cmax');
wmin=document.getElementById('wmin');
wmax=document.getElementById('wmax');
minint=parseInt(min.value);
maxint=parseInt(max.value);
if(maxint<minint)
maxint=minint+1;
wmin.value=minint;
min.value=minint;
wmax.value=maxint;
max.value=maxint;
}
</script>
</head>
<body>
<?php
function tworz_baze() {
require('c13ustawienia.php');
$link=mysqli_connect($serwer, $uzytk, $haslo);
mysqli_query($link, "DROP DATABASE $baza");
mysqli_query($link, "CREATE DATABASE $baza");
mysqli_query($link, "USE $baza");
mysqli_query($link, "CREATE TABLE auta (
ID int(8) NOT NULL AUTO_INCREMENT PRIMARY KEY,
marka varchar(20),
model varchar(25),
rok int(4),
cena double)");
return $link;
} // tworz_baze()
function czytajdane($plik) {
$f=fopen($plik, 'r');
while(!feof($f)) {
$linia=rtrim(fgets($f));
if(strlen($linia)>5)
$tab[]=explode('|', $linia);
}
return $tab;
} // czytajdane($plik)
function dobazy($link, $tablica) {
foreach ($tablica as $sam) {
list($rok, $mar, $mod, $cena)=$sam;
mysqli_query($link, "INSERT INTO auta VALUES
(NULL, '$mar', '$mod', $rok, $cena)");
}
} // dobazy($link, $tablica)
function pisz($li, $marka, $cenamin, $cenamax) {
echo "<h3>Wybrano:<br>marka: $marka<br>
zakres cen: $cenamin - $cenamax zł</h3>";
echo "<table>
<tr><th>id</th><th>marka</th><th>model</th>
<th>rok</th><th>cena</th></tr>";
$wyn=mysqli_query($li, "SELECT * FROM auta WHERE
marka='$marka' AND cena>=$cenamin AND cena<=$cenamax");
$licznik=FALSE;
while($wiersz=mysqli_fetch_array($wyn)) {
list($id, $mar, $mod, $rok, $cena)=$wiersz;
$kolor = $licznik ? 'zolty' : 'pomar';
echo "<tr class=\"$kolor\"><th class=\"id\">$id</td>
<td class=\"mar\">$mar</td>
<td class=\"mod\">$mod</td>
<td class=\"rok\">$rok</td>
<td class=\"cena\">$cena</td></tr>";
$licznik=!$licznik;
}
echo '</table>';
mysqli_close($li);
} // pisz($li, $model, $cenamax)
function filtry() {
if(isset($_GET['cmin']))
$tab['cmin']=$_GET['cmin'];
else
$tab['cmin']=0;
if(isset($_GET['cmax']))
$tab['cmax']=$_GET['cmax'];
else
$tab['cmax']=CENAMAKS;
if(isset($_GET['marka']))
$tab['marka']=$_GET['marka'];
else
$tab['marka']='Volkswagen';
return $tab;
} // filtry()
function lista($link) {
$w=mysqli_query($link, "SELECT DISTINCT marka
from auta ORDER BY marka");
while($m=mysqli_fetch_array($w))
echo '<option value="'.$m['marka'].'">'
.$m['marka'].'</option>';
// $x=$m['marka'];
// "<option value=\"$x\">....
} // lista($link)
?>
<header>
<img src="auto.png" alt="auto">
<span>Komis samochodowy</span>
</header>
<nav>
<h3>Filtry:</h3>
<form action="c41.php" method="GET">
Cena:<br>
od: <input type="range" name="cmin" id="cmin"
min="0" max="<?php echo CENAMAKS ?>" value="<?php echo $tf['cenamin'];?>"
onchange="wartosc()">
<br>
do :<input type="range" name="cmax" id="cmax"
min="0" max="<?php echo CENAMAKS ?>"
value="<?php echo $tf['cenamin'];?>"
onchange="wartosc()">
<br>
<input type="text" name="wmin" id="wmin" disabled
value="<?php echo $tf['cenamin'];?>"
> -
<input type="text" name="wmax" id="wmax" disabled
value="<?php echo $tf['cenamax'];?>"
><br>
<select name="marka" id="marka">
<?php lista($li); ?>
</select>
<input type="submit" value="Filtruj">
<input type="reset" value="Czyść">
</form>
</nav>
<main>
<?php pisz($li, $tf['marka'], $tf['cmin'], $tf['cmax']); ?>
</main>
<footer>
Adam Kowal ©
</footer>
</body>
</html>
To make inputs work I have giving them variable of function and pointed right key of database to have what I want, but i have no clue how to make it work with select option
frame of code that gives me what i want in inputs: value="<?php echo $tf['cenamin'];?>"
Change your code with the following:
First add a new parameter to the "lista" function to be able to mark the selected value, e.g.
function lista($link, $selected = "default") {
// function code here
}
Secondly, modify the function to respect the passed value and match it to the value gotten from the database:
while($m=mysqli_fetch_array($w)) {
$status = "";
if ($selected == $m['marka']) $status = "selected";
echo '<option '.$selected.' value="'.$m['marka'].'">' .$m['marka'].'</option>';
}
Thirdly, pass the selected value to the function in your code, e.g.:
<?php lista($li, $_GET['marka']); ?>
NB! You should NOT use your current code in any production environments: it includes several SQL injections and isn't built up by best practises (e.g. separating html from the program code etc).

How to put php table into html sidebar?

Hi im a begginer in php and html i would like to ask how do i put this table into my html sidelist. when i put my table inside that space this always appear ( "; foreach($testaroni as $x=>$y) { echo ""; echo "" . $y . ""; } echo ""; echo ""; ?>)
This is my table. This is the problem (2)
<?php
session_start();
$testaroni = explode("', '" , $_SESSION["data"]);
?>
<?php
echo "<table border = '1'>";
foreach($testaroni as $x=>$y) {
echo "<tr>";
echo "<td>" . $y . "</td>";
}
echo "</tr>";
echo "</table>";
?>
And i would like to put it inside here.
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.links line {
stroke: #999;
stroke-opacity: 0.6;
}
.nodes circle {
stroke: #fff;
stroke-width: 1.5px;
}
text {
font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif;
font-size: 10px;
}
</style>
<?php
session_start();
$testaroni = explode("', '" , $_SESSION["data"]);
?>
<html>
<head>
<title>Search</title>
</head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<body>
<!-- Sidebar -->
<div class="w3-sidebar w3-blue-grey w3-bar-block " style="width:15%">
<h4 class="w3-bar-item">Sidelist</h4>
<table border = "1">
<?php
foreach($testaroni as $x=>$y) {
echo '<tr>';
echo '<td>' . $y . '</td>';
}
echo '</tr>';
?>
</table>
</div>
</form>
</body>
</html>
You just need to modify your explode function and your code will work as you want
session_start();
//lets say your $_SESSION["data"] contains
$_SESSION["data"] = 'Value1,Value2,Value3';
//$testaroni = explode("', '" , $_SESSION["data"]);// just use single or double quotes without space
$testaroni = explode("," , $_SESSION["data"]);
You try var_dump( $_SESSION["data"]) and you should check empty $_SESSION["data"].I try put
$testaroni = array("1","2","3");//it work fine
You can read more about my this here
Seems like my eyes are failing me took me a while to see it.
You shouldn't use " when trying to use HTML tags in PHP
What you need to use is '.
<table border = "1">
<tr>
<?php
foreach($testaroni as $x=>$y) {
echo '<td>'.$y.'</td>';
}
?>
</tr>
</table>
The reason for this is that " will treat anything inside it as string while ' will treat it as is.
Refer here for a better explanation.
Also, follow the answer above for your session since it's also wrong.
Your session variable is a CSV string. simply exploding on the comma isn't going to get what you're looking for. You can verify this with var_dump($testaroni);.
Use str_getcsv.
<?php
// always start with php logic;
// it makes the script much easier to follow and
// if you need to redirect, you haven't put out any output yet.
session_start();
// check the docs for info on this function
$testaroni = str_getcsv($_SESSION['data']);
// then, when everything is calculated, print out your output
?>
<html>
<head>
<title>Search</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<style>
.links line {
stroke: #999;
stroke-opacity: 0.6;
}
.nodes circle {
stroke: #fff;
stroke-width: 1.5px;
}
text {
font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif;
font-size: 10px;
}
</style>
</head>
<body>
<!-- Sidebar -->
<div class="w3-sidebar w3-blue-grey w3-bar-block " style="width:15%">
<h4 class="w3-bar-item">Sidelist</h4>
<table border = "1">
<?php foreach($testaroni as $y): ?>
<tr>
<td><?= $y ?></td>
</tr>
<?php endforeach; ?>
</table>
</div>
</form>
</body>
</html>

Removing an option from dropbox after selected

I have a state guessing guess I wrote. I'm trying to remove a capital from the dropbox menu after it has been guessed. Any clues on how to go about doing that?
I have a comment on line 44 which is code that I believe may work but I havent been able to get working.
Thanks for reading and thanks in advance!
Heres my code:
<?php
require_once "include/session.php";
if (!isset($session->valid)) {
header("location: login.php");
exit();
}
require_once "include/city_info.php";
/* DO NOT MODIFY THE ABOVE LINES !!!!! */
$states = array_keys($state_capitals);
$capitals = array_values($state_capitals);
$cities = array_merge($capitals, $other_cities);
sort($cities);
$params = (object) $_REQUEST;
if (isset ($params->guess) ) {
$state = $session->statename;
$capital = $params->city;
$city = $params->city;
$session->guess ++ ;
//if they guess correctly
if ($capital == $state_capitals[$session->statename]){
$response = "You've Guessed Correct After $session->guess Guesses";
}
//if they guess incorrectly
else {
$response = " You've Guessed Wrong $session->guess Times";}
}
else {
$index = rand( 0, count($states)- 1 );
$state = $states[ $index ];
$city = $state_capitals[ $state ];
$session->statename = $state;
$guess = (0);
$session->guess = (0);
$response = "Try To Get Less Than 3 Guesses";
// create initial selections
//$session->selections = array();
// foreach($city as $value) {
// $session->selections[$value] = 1;
//}
}
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta http-equiv="Cache-Control"
content="no-cache, max-age=0, no-store, must-revalidate" />
<title>State Capital Guessing Game</title>
<style type="text/css">
body {
background-color:#ffff4d;
}
div {
position:center;
width: 350px;
padding: 10px;
border: 3px solid black;
border-radius: 10px;
color: black;
background-color:#3399ff;
}
}
h1{
padding:5px;
}
h2 {
text-align: center;
font-size:20px;
}
h3 {
text-align:center;
}
h4 {
text-align:center;
}
h5 {
position: absolute;
top:0px;
right:0px;
}
#logout {
position: absolute;
top: 0px;
right: 0px;
}
</style>
</head>
<body>
<a id="logout" href="logout.php">Log out</a>
<h1>
State Capital Guess Game
<form action="program.php" method="get">
<button type="submit">Reset</button>
</h1>
</form>
<div>
<form action="program.php" method="post">
<input type="hidden" name="answer" value="<?php echo $state?>" />
<h2>
Guess the capital of: <?php echo "$session->state" ?>
</h2>
<h3>
<select name="city">
<?php
$options = "";
foreach ($cities as $value){
$options .= '<option value="' . $value . '"';
if ($value == $params->city)
$options .= ' selected';
$options .= '>' . $value . '</option>';
}
echo $options;
?>
</select>
<input type="submit" name="guess" value="Guess" />
</form>
</h3>
<h4><?php echo $response ?></h4>
</div>
<h5><?php echo "The Correct Answer Is: $state_capitals[$state]" ?><h5>
</body>
</html>​

Dropdown list displays url in different frame html-php

I can use only html and php.
i have a page with 2 frames. 1 left and 1 main.
On the left i have a dropdown list and a submit button.I want when i press submit button to display the url of the option of dropdown list in the main.php.
The page that creates 2 frames.
<!DOCTYPE html>
<html>
<frameset cols="25%,*" >
<frame src="left5.php" name="leftFrame" id="leftFrame" title="leftFrame" />
<frame src="main5.php" name="mainFrame" id="mainFrame" title="mainFrame" />
</frameset>
</frameset>
<body>
</body>
</html>
LEFT frame
<!DOCTYPE html>
<html>
<body>
<form name="links" action="main5.php" method="post">
<select name="NAME" id="ex_name">
<option value="../url1.html">URL1</option>
<option value="../url2.php">URL2</option>
<option value="../url3.php">URL3</option>
</select><input type="submit" value="GO!" name="submit"/>
</form>
</body>
</html>
Main frame
<!DOCTYPE html>
<html>
<body>
<?php
$ep = $_POST['links'];
echo "$ep"
?>
</body>
</html>
I cant use javascript.I know my fault is in $_POST
For your PHP, you're going to have to use something like switch and $_get functions to call the page.
Below is how I would do it.
It does not include how to work it out with frames, but it will show you how to call a local page in PHP.
index.php
body {
margin: 0;
background-color: red;
}
.mymenu {
position: absolute;
width: 300px;
top: 0;
left: 0;
background-color: blue;
}
.mymenu a {
color: #FFF;
}
.main{
margin-left: 300px; /* because of .mymenu's width */
}
<div class="mymenu">
Link1<br />
Link2<br />
Link3
</div>
<div class="main">
<?php
include("things.php"); /* open things.php */
?>
</div>
things.php
/* get p from URL */
if (isset($_GET["p"])) { $p = $_GET["p"]; } else { $p = ""; }
function anotherThing(){
echo "anotherThing page";
}
function thatThing(){
echo "thatThing page";
}
function thisThing(){
echo "thisThing page";
}
/* called from e.g. http://yourwebsite.com/index.php?p=whatever2 */
switch($p) {
case "whatever3":
anotherThing();
break;
case "whatever2":
thatThing();
break;
case "whatever1":
default:
thisThing();
break;
}

Load Google Maps on webpage using Javascript and PHP through drop down form

I am having two drop down lists on a html page. The data is coming from a mysql database and contains information like latitude, longitude and address. The user selects one item from the drop down and clicks on submit.
At this stage, I want to display a google map and put a marker at the latitude and longitude. Then, when the user selects the option from second drop down, I want to just add a marker on that map.
Currently, I am able to load the map once he clicks the submit from first drop down but all the options I tried to drop the pins are not working.
Here is the code I have achieved till now:
<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');
require_once('auth.php');
include ('LoginConfig.php');
include ('FetchAgentDetails.php');
include ('FetchDeliveryDetails.php');
?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Delivery Management System</title>
<script src="http://maps.googleapis.com/maps/api/js?key=AIzaSyA0Rm5aK0BYu1f_TzhjkG97cchHHlQfrQY&sensor=false">
</script>
<style type="text/css">
html {height:100%}
body {height:100%;margin:0;padding:0}
#googleMap {height:100%}
</style>
<script>
function initialize()
{
var mapProp = {
center:new google.maps.LatLng(51.508742,-0.120850),
zoom:5,
mapTypeId:google.maps.MapTypeId.ROADMAP
};
var map=new google.maps.Map(document.getElementById("googleMap")
,mapProp);
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>
<style type="text/css">
<!--
.style1 {
font-size: 20px;
font-weight: bold;
}
-->
</style>
<style type="text/css">
table.collection {width:250px;border:2px solid black;border-style: outset;border-collapse:collapse;}
table.collection tr {background-color:#fff; border-bottom: 1px #99b solid;padding:10px;}
table.collection tr:hover {background-color:#ffe;}
table.collection td {display:table-cell;border-bottom: 1px #99b solid; padding:10px;}
table.collection td a {text-decoration:none; display:table-row; padding:0px; height:100%;}
</style>
</head>
<body bgcolor="#8E8E38"
<div style="clear: right;">
<p align="left" class="style1">Welcome Delivery Manager! </p>
<img style="position: absolute; top: 0; right: 0;" src="./Images/logo.jpg" alt="Company Logo" width="90" height="60" align="middle"></img>
</div>
<p align="left">Home</p>
<hr></hr>
<!-- START Main Wrap -->
<form method="post">
<fieldset>
<div style="clear: left;float:left;">
<label for="deliveryList">Delivery Items:</label>
<select name="deliveryList" id="deliveryList">
<option value="Select delivery item" selected="selected">Select delivery item</option>
<?php
$deliveryHandler = new FetchDeliveryDetails();
$itemNameArray = $deliveryHandler->getItemNames();
foreach ($itemNameArray as $innerArray) {
if (is_array($innerArray)) {
$value = $innerArray['itemName'];
echo "<option value=\"$value\"";
if (isset($_POST['deliveryList']) && $_POST['deliveryList'] == $value)
echo 'selected';
echo ">" . $value . "</option>\n";
}
}
?>
</select>
<input type="submit" name="submit" id="submit" value="Submit"/>
</div>
<div style="clear: right;float:right;">
<label for="agentList">Avaliable Agent:</label>
<select name="agentList" id="agentList">
<option value="" selected="selected">Select agent to assign</option>
<?php
$agentHandler = new FetchAgentDetails();
$agentNameArray = $agentHandler->getAgentNames();
foreach ($agentNameArray as $innerArray) {
if (is_array($innerArray)) {
$agentId = $innerArray['agentId'];
$firstNameValue = $innerArray['firstname'];
$lastNameValue = $innerArray['lastname'];
$fullName = $firstNameValue . ' ' . $lastNameValue;
echo "<option value=\"$agentId\">$fullName</option>\n";
}
}
?>
</select>
<input type="submit" name="agentSubmit" id="agentSubmit" value="Check Location"/>
</div>
</fieldset>
</form>
<?php
if (isset($_POST['deliveryList'])) {
$selectedItemName = $_POST['deliveryList'];
$deliveryHander = new FetchDeliveryDetails();
$itemDetailsArray = $deliveryHander->getAllDeliveryDetails($selectedItemName);
foreach ($itemDetailsArray as $valuesArray) {
$itemNameValue = $valuesArray['itemName'];
$itemDescriptionValue = $valuesArray['itemDescription'];
$ownerFirstname = $valuesArray['firstName'];
$ownerLastname = $valuesArray['lastName'];
$dateAdded = $valuesArray['dateAdded'];
$deliveryDate = $valuesArray['deliveryDate'];
$deliveryAddress = $valuesArray['deliveryAddress'];
$deliveryLatitude = $valuesArray['deliveryLatitude'];
$deliveryLongitude = $valuesArray['deliveryLongitude'];
$assignedAgent = $valuesArray['assignedAgentId'];
if ($assignedAgent == 0) {
$assignedAgent = "-";
}
echo "<table border=\"1\" align=\"left\" class =\"collection\">\n";
echo "<tr>\n";
echo "<td >Item Name:<b>$itemNameValue</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td>Item Description: <b>$itemDescriptionValue</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td>Owner Name: <b>$ownerFirstname $ownerLastname</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td>Date Added: <b>$dateAdded</td>\n";
echo "</tr>\n";
echo "<tr>";
echo "<td>Delivery Date: <b>$deliveryDate</td>";
echo "</tr>";
echo "<tr>";
echo "<td>Delivery Address: <b>$deliveryAddress</td>";
echo "</tr>";
echo "<tr>";
echo "<td>Assigned Agent: <b>$assignedAgent</td>";
echo "</tr>";
echo "</table>";
echo "<div id=\"googleMap\" style=\"width:500px;height:380px;\"></div>";
}
}
if (isset($_POST['agentList'])) {
}
?>
</body>
</html>
I almost forgot, this is my first PHP application, in fact my first web application. So please go easy on me. Point out other errors also, but please stick to the question.
Ok got it working by using iframe :) and a bit of php
Reference:
http://www.youtube.com/watch?v=HTm-3Cduafw
echo "<iframe style =\"display: block;
width: 800px;
padding-top: 2px;
height: 400px;
margin: 0 auto;
border: 0;\" width=\"425\" height=\"350\" align=\"center\" frameborder=\"0\" scrolling=\"no\" marginheight=\"0\" marginwidth=\"0\"
src=\"https://maps.google.com/maps?f=d&source=s_d&saddr=$agent_map_url&
daddr=$map_url&hl=en&z=10&t=m&mra=ls&ie=UTF8&output=embed\"></iframe><br/>";

Categories