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.

Recommended Answers

All 8 Replies

OMG Thanks SOOO Much. :)

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?

I think you need to change it to hid instead of name

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

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

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!

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.

I dont have the full project on my webserver. Just working on my Xampp server at home. But I did not change the value option to hid. I was unaware I had to do so. I will try that as soon as I get home, thanks.

Here is the test project I am working on. http://www.globalvirtualairlines.com/MyPages/testing.php

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.