0

I need some help, some of the recent posts I made probably made no sense. lol.

XML file im working with: http://www.vafinancials.com/web/hubs_xml.php?id=18686

I had an Idea but am unsure of how to use it.
I thought of using something like a SQL query to echo out certain hub info.

Like setting a variable like $hub then choosing certain data from the XML file where the name is = $hub which would be the value of the Select Menu.

Ive been scratching my head at this for weeks. Please help. Thanks in advance.

3
Contributors
8
Replies
9
Views
6 Years
Discussion Span
Last Post by Joshua Kidd
0

I used what you gave me. and am testing it. Here is what I have for the gethub.php page

<?php
$id=$_GET["id"];

$xmlDoc = new DOMDocument();
$xmlDoc->load("http://www.vafinancials.com/web/hubs_xml.php?id=18686");

$x=$xmlDoc->getElementsByTagName('name');

for ($i=0; $i<=$x->length-1; $i++)
{
//Process only element nodes
if ($x->item($i)->nodeType==1)
  {
  if ($x->item($i)->childNodes->item(0)->nodeValue == $id)
    {
    $y=($x->item($i)->parentNode);
    }
  }
}
 ///line20 $hub=($y->childNodes);
 ///line21 for ($i=0;$i<$hub->length;$i++)
{ 
//Process only element nodes
if ($hub->item($i)->nodeType==1)
  {
  echo("<b>" . $hub->item($i)->nodeName . ":</b> ");
  echo($hub->item($i)->childNodes->item(0)->nodeValue);
  echo("<br />");
  }
}
?>

I get this error when I choose the option:::

Notice: Undefined variable: y in C:\xampp\htdocs\VAFS\gethub.php on line 20

Notice: Trying to get property of non-object in C:\xampp\htdocs\VAFS\gethub.php on line 20

Notice: Trying to get property of non-object in C:\xampp\htdocs\VAFS\gethub.php on line 21

Any Ideas?

0

I changed it to hid. but it is still giving me that error.

I would advice that you learn JS library for all your JS operations. JQuery is on top of my recommendation list!

0

There are so many reasons your code is not working

1) Here below you can see that there is problem in value portion of your option. You must set hid here intead of 'OPTION', what ever you write in value='' is posted to next page. Title is not sent to next page

<select name="selectmenu" id="selectmenu"> 
<option value="choose a hub">Chose a hub </option> 
<option value='option'>Los Angeles Intl</option>
<option value='option'>Heathrow</option>
<option value='option'>Kennedy Intl</option>
<option value='option'>Toronto/Pearson Intl</option>
<option value='option'>Phoenix Sky Harbor Intl</option>
<option value='option'>The Hartsfield Atlanta Intl</option>
<option value='option'>Miami Intl</option>
<option value='option'>Denver Intl</option>

2) Also you have not created gethub.php file in mypages folder
3) you have not called gethub.php from you jquerytestingapp.php file. When user select value for list box then some event say onchange is to set.

Edited by urtrivedi: n/a

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.