Jump to content

Malcolmhire2001

Members
  • Posts

    26
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Malcolmhire2001's Achievements

Member

Member (2/5)

0

Reputation

  1. thanks for your replys, i have updated my index.php page to <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Welcome To Jedwater Caravan Park</title> </head> <link href="/css/menu.css" rel="stylesheet" type="text/css"> <link href="/css/style.css" rel="stylesheet" type="text/css"> <div align="center"><img src="/pictures/jednewlogo.png"></div> <body> <div id="container"> <ul id="navbar"> <li class="navbar <?php if($_GET['page'] == "contact") { echo "current"; } ?>"><a href="/contact/">Contact</a></li> <li class="navbar <?php if($_GET['page'] == "about") { echo "current"; } ?>"><a href="/about/">About</a></li> <li class="navbar <?php if($_GET['page'] == "reviews") { echo "current"; } ?>"><a href="/reviews/">Reviews</a></li> <li class="navbar <?php if($_GET['page'] == "sitehire") { echo "current"; } ?>"><a href="/sitehire/">Site Hire</a></li> <li class="navbar <?php if($_GET['page'] == "prices") { echo "current"; } ?>"><a href="/prices/">Season Prices</a></li> <li class="navbar <?php if($_GET['page'] == "facilities") { echo "current"; } ?>"><a href="/facilities/">Park Facilities</a></li> <li class="navbar current <?php if($_GET['page'] == "/") { echo ""; } ?>"><a href="/">Home</a></li> </ul> </div> <div style="clear:both;"></div> </div> <center> <div id="main"> <?php include $_GET['page']; ?> </div> <div id="bottomcontainer"> <ul id="bottomnavbar"> <li class="bottomnavbar <?php if($_GET['page'] == "contact.php") { echo "current"; } ?>"><a href="/contact/">Contact</a></li> <li class="bottomnavbar <?php if($_GET['page'] == "about.php") { echo "current"; } ?>"><a href="/about/">About</a></li> <li class="bottomnavbar <?php if($_GET['page'] == "reviews.php") { echo "current"; } ?>"><a href="/reviews/">Reviews</a></li> <li class="bottomnavbar <?php if($_GET['page'] == "sitehire.php") { echo "current"; } ?>"><a href="/sitehire/">Site Hire</a></li> <li class="bottomnavbar <?php if($_GET['page'] == "prices.php") { echo "current"; } ?>"><a href="/prices/">Season Prices</a></li> <li class="bottomnavbar <?php if($_GET['page'] == "facilities.php") { echo "current"; } ?>"><a href="/facilities/">Park Facilities</a></li> <li class="bottomnavbar <?php if($_GET['page'] == "home.php") { echo "current"; } ?>"><a href="/">Home</a></li> </ul> </div> </body> </html> and my htaccess to <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^(.*)$ index.php?page=$1 [L] </IfModule> now apache server is crashing and keeps crashing every time i try to load a page errors from apache erro log: Thu Nov 01 16:09:18 2007] [notice] Parent: child process exited with status 3221225725 -- Restarting. [Thu Nov 01 16:09:18 2007] [notice] Apache/2.2.3 (Win32) PHP/5.2.0 configured -- resuming normal operations [Thu Nov 01 16:09:18 2007] [notice] Server built: Jul 27 2006 16:49:49 [Thu Nov 01 16:09:18 2007] [notice] Parent: Created child process 10936 [Thu Nov 01 16:09:19 2007] [notice] Child 10936: Child process is running [Thu Nov 01 16:09:19 2007] [notice] Child 10936: Acquired the start mutex. [Thu Nov 01 16:09:19 2007] [notice] Child 10936: Starting 250 worker threads. [Thu Nov 01 16:09:19 2007] [notice] Child 10936: Starting thread to listen on port 80. [Thu Nov 01 16:09:26 2007] [notice] Parent: child process exited with status 255 -- Restarting. [Thu Nov 01 16:09:27 2007] [notice] Apache/2.2.3 (Win32) PHP/5.2.0 configured -- resuming normal operations [Thu Nov 01 16:09:27 2007] [notice] Server built: Jul 27 2006 16:49:49 [Thu Nov 01 16:09:27 2007] [notice] Parent: Created child process 13392 [Thu Nov 01 16:09:27 2007] [notice] Child 13392: Child process is running [Thu Nov 01 16:09:27 2007] [notice] Child 13392: Acquired the start mutex. [Thu Nov 01 16:09:27 2007] [notice] Child 13392: Starting 250 worker threads. [Thu Nov 01 16:09:27 2007] [notice] Child 13392: Starting thread to listen on port 80. [Thu Nov 01 16:09:30 2007] [notice] Parent: child process exited with status 3221225725 -- Restarting. [Thu Nov 01 16:09:30 2007] [notice] Apache/2.2.3 (Win32) PHP/5.2.0 configured -- resuming normal operations [Thu Nov 01 16:09:30 2007] [notice] Server built: Jul 27 2006 16:49:49 [Thu Nov 01 16:09:30 2007] [notice] Parent: Created child process 13524 [Thu Nov 01 16:09:30 2007] [notice] Child 13524: Child process is running [Thu Nov 01 16:09:30 2007] [notice] Child 13524: Acquired the start mutex. [Thu Nov 01 16:09:30 2007] [notice] Child 13524: Starting 250 worker threads. [Thu Nov 01 16:09:30 2007] [notice] Child 13524: Starting thread to listen on port 80. Thanks for any help, i'm trying to work it ou myself be having no joy. Cheers, Mal
  2. it defined when ethier entering it into the URL address bar, if you were wanting the page "contact" it would be http://localhost/index.php?page=contact.php also defined a hyperlink the hyperlink would be: <a href="?page=contact.php">Contact</a> is this the best way around including a file useing a template or is there a better way. Thanks, Mal
  3. no that doesn't work either My included page doesn't display, css doesn't display and all the styles are all over hthe place this is my code for index.php <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Welcome To Jedwater Caravan Park</title> </head> <link href="/css/menu.css" rel="stylesheet" type="text/css"> <link href="/css/style.css" rel="stylesheet" type="text/css"> <div align="center"><img src="/pictures/jednewlogo.png"></div> <body> <div id="container"> <ul id="navbar"> <li class="navbar <?php if($_GET['page'] == "contact.php") { echo "current"; } ?>"><a href="/contact/">Contact</a></li> <li class="navbar <?php if($_GET['page'] == "about.php") { echo "current"; } ?>"><a href="/about/">About</a></li> <li class="navbar <?php if($_GET['page'] == "reviews.php") { echo "current"; } ?>"><a href="/reviews">Reviews</a></li> <li class="navbar <?php if($_GET['page'] == "sitehire.php") { echo "current"; } ?>"><a href="/sitehire/">Site Hire</a></li> <li class="navbar <?php if($_GET['page'] == "prices.php") { echo "current"; } ?>"><a href="/sitehire/">Season Prices</a></li> <li class="navbar <?php if($_GET['page'] == "facilities.php") { echo "current"; } ?>"><a href="/sitehire/">Park Facilities</a></li> <li class="navbar <?php if($_GET['page'] == "home.php") { echo "current"; } ?>"><a href="/">Home</a></li> </ul> </div> <div style="clear:both;"></div> </div> <center> <div id="main"> <?php if(file_exists($page)) { include $page; } else { echo "No Page Exists"; } ?> </div> <div id="bottomcontainer"> <ul id="bottomnavbar"> <li class="bottomnavbar <?php if($_GET['page'] == "contact.php") { echo "current"; } ?>"><a href="/contact/">Contact</a></li> <li class="bottomnavbar <?php if($_GET['page'] == "about.php") { echo "current"; } ?>"><a href="/about/">About</a></li> <li class="bottomnavbar <?php if($_GET['page'] == "reviews.php") { echo "current"; } ?>"><a href="/reviews/">Reviews</a></li> <li class="bottomnavbar <?php if($_GET['page'] == "sitehire.php") { echo "current"; } ?>"><a href="/sitehire/">Site Hire</a></li> <li class="bottomnavbar <?php if($_GET['page'] == "prices.php") { echo "current"; } ?>"><a href="/prices/">Season Prices</a></li> <li class="bottomnavbar <?php if($_GET['page'] == "facilities.php") { echo "current"; } ?>"><a href="/facilities/">Park Facilities</a></li> <li class="bottomnavbar <?php if($_GET['page'] == "home.php") { echo "current"; } ?>"><a href="/">Home</a></li> </ul> </div> </body> </html> if you can see any errors in my index.php file that mighh be the reason behind my problems Thanks, Mal
  4. can anybody help? really can't work this out Thanks, mal
  5. Hello, I need help with mod re write all i am wanting is to change my dynamic address which is: http://localhost/index.php?page=home.php To http://localhost/home/ and same for all my other pages for example http://localhost/contact http://localhost/prices if you could please help that would be great thanks, Mal
  6. thats great that worked straight away thank you very much you have saved me alot of time. thanks, Mal
  7. hello, I have created a form for information to be entered i am then posting this form to this page: [code] !DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Untitled Document</title> </head> <body> <?php $type = $_POST['type'];     $xml = simplexml_load_file('holidays.xml');     echo "<B>Using direct method...</B><BR />"; $names = $xml->xpath('/holidays/holiday[type= "$type"]');     foreach($names as $name) {         echo "Found {$name->type}<BR />";     }     echo "<BR />"; ?> </body> </html> [/code] and storing the POST as a variable, the variable is then suppose to be the criteria for the XPath Search, but the search does not bring up any results. Only the Text that is echoed out which is: "Using direct method..." if anyone could help Thanks, Mal
  8. hello again, what i am trying to do is to post some variables from a search form (seprate file) to some script that processes query using Xpath. the variables are working fine as i echoed them out, i just want the query to display the same data that is stored in my XML file using for example $type variable this would either be cottage, hotel, boat ect  and say "Hotel" was stored in the variable then display the infomation about all the Hotel holidays. if anyone could help it would be great. Query Code: [code]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>CG0119 Week 10, Task 2</title> </head> <body> <?php echo $type = $_POST['type']; echo $destination = $_POST['destination']; echo $ckin = $_POST['ckin']; echo $ckout = $_POST['ckout']; echo $rooms = $_POST['rooms']; echo $adult = $_POST['adult']; echo $children = $_POST['children']; echo $min = $_POST['min']; echo $max = $_POST['max']; // ************************ // *** PROCESS THE FORM *** // ************************ $doc = new DOMDocument; $doc->preserveWhiteSpace = false; $doc->Load('holidays.xml'); $xpath = new DOMXPath($doc); // Create the query string based on which option the user selected // (start at the root element and include a condition if required). if ("$type")  { $query = '//students/student/studyTypeID[. = "$type"]'; // Execute the query and return a DOMNodeList containing all // of the nodes that match the XPath expression. $entries = $xpath->query($query); echo "<ul>\n"; // Display the required values for each entry returned by the XPath query. foreach ($entries as $entry) { echo "<li>{$entry->nodeValue}</li>\n"; } echo "</ul>\n"; } // close the process the form if statement ?> </body> </html>[/code] XML Code: [code]<?xml version="1.0" ?> <holidays> <holiday> <holidaycode>C1257</holidaycode> <type>Cottage</type> <maxsleeps>8</maxsleeps> <company>Allseasons</company> <location>Fulbeck, Northumberland</location> <dates> <date> <startdate>29-10-2006</startdate> <enddate>31-10-2006</enddate> <duration>3</duration> <costprice>419</costprice> </date> <date> <startdate>12-11-2006</startdate> <enddate>14-11-2006</enddate> <duration>3</duration> <costprice>419</costprice> </date> <date> <startdate>08-04-2007</startdate> <enddate>10-04-2007</enddate> <duration>3</duration> <costprice>621</costprice> </date> <date> <startdate>28-05-2007</startdate> <enddate>04-06-2007</enddate> <duration>5</duration> <costprice>1045</costprice> </date> <date> <startdate>01-08-2007</startdate> <enddate>07-08-2007</enddate> <duration>7</duration> <costprice>1242</costprice> </date> </dates> </holiday> <holiday> <holidaycode>C4981</holidaycode> <type>Cottage</type> <maxsleeps>6</maxsleeps> <company>NewHolidays</company> <location>Old Cornsay, County Durham</location> <dates> <date> <startdate>21-12-2006</startdate> <enddate>27-12-2006</enddate> <duration>7</duration> <costprice>569</costprice> </date> <date> <startdate>14-02-2007</startdate> <enddate>16-02-2007</enddate> <duration>3</duration> <costprice>250</costprice> </date> <date> <startdate>03-06-2007</startdate> <enddate>09-06-2007</enddate> <duration>7</duration> <costprice>427</costprice> </date> <date> <startdate>22-07-2007</startdate> <enddate>24-07-2007</enddate> <duration>3</duration> <costprice>453</costprice> </date> <date> <startdate>16-09-2007</startdate> <enddate>22-09-2007</enddate> <duration>7</duration> <costprice>416</costprice> </date> </dates> </holiday> <holiday> <holidaycode>C2529</holidaycode> <type>Cottage</type> <maxsleeps>4</maxsleeps> <company>DorsetHols</company> <location>North Beaminster, Dorset</location> <dates> <date> <startdate>14-10-2007</startdate> <enddate>20-10-2007</enddate> <duration>7</duration> <costprice>313</costprice> </date> <date> <startdate>20-08-2007</startdate> <enddate>26-08-2007</enddate> <duration>7</duration> <costprice>629</costprice> </date> <date> <startdate>03-01-2007</startdate> <enddate>05-01-2007</enddate> <duration>3</duration> <costprice>569</costprice> </date> <date> <startdate>04-11-2006</startdate> <enddate>10-11-2006</enddate> <duration>7</duration> <costprice>280</costprice> </date> <date> <startdate>10-04-2007</startdate> <enddate>12-04-2007</enddate> <duration>3</duration> <costprice>307</costprice> </date> </dates> </holiday> <holiday> <holidaycode>B2389</holidaycode> <type>Boating</type> <maxsleeps>7</maxsleeps> <company>ElvinBoats</company> <location>River Bure, Horning, Norfolk</location> <dates> <date> <startdate>02-07-2007</startdate> <enddate>08-07-2007</enddate> <duration>7</duration> <costprice>995</costprice> </date> <date> <startdate>19-08-2007</startdate> <enddate>25-08-2007</enddate> <duration>7</duration> <costprice>1242</costprice> </date> <date> <startdate>15-05-2007</startdate> <enddate>17-05-2007</enddate> <duration>3</duration> <costprice>530</costprice> </date> <date> <startdate>25-03-2007</startdate> <enddate>27-03-2007</enddate> <duration>3</duration> <costprice>432</costprice> </date> <date> <startdate>02-09-2007</startdate> <enddate>08-09-2007</enddate> <duration>7</duration> <costprice>978</costprice> </date> </dates> </holiday> <holiday> <holidaycode>B1078</holidaycode> <type>Boating</type> <maxsleeps>6</maxsleeps> <company>FloatingHols</company> <location>River Bure, Wroxham, Norfolk</location> <dates> <date> <startdate>24-06-2007</startdate> <enddate>30-06-2007</enddate> <duration>7</duration> <costprice>682</costprice> </date> <date> <startdate>29-10-2006</startdate> <enddate>31-10-2006</enddate> <duration>3</duration> <costprice>419</costprice> </date> <date> <startdate>15-04-2007</startdate> <enddate>21-04-2007</enddate> <duration>7</duration> <costprice>680</costprice> </date> <date> <startdate>03-06-2007</startdate> <enddate>09-06-2007</enddate> <duration>7</duration> <costprice>853</costprice> </date> <date> <startdate>08-09-2006</startdate> <enddate>10-09-2006</enddate> <duration>3</duration> <costprice>476</costprice> </date> </dates> </holiday> <holiday> <holidaycode>B0988</holidaycode> <type>Boating</type> <maxsleeps>6</maxsleeps> <company>Andersons</company> <location>River Ant, Stalham, Norfolk</location> <dates> <date> <startdate>17-06-2007</startdate> <enddate>23-06-2007</enddate> <duration>7</duration> <costprice>930</costprice> </date> <date> <startdate>22-07-2007</startdate> <enddate>28-07-2007</enddate> <duration>7</duration> <costprice>1190</costprice> </date> <date> <startdate>10-05-2007</startdate> <enddate>12-05-2007</enddate> <duration>3</duration> <costprice>530</costprice> </date> <date> <startdate>23-07-2007</startdate> <enddate>25-07-2007</enddate> <duration>3</duration> <costprice>884</costprice> </date> <date> <startdate>02-09-2006</startdate> <enddate>08-09-2006</enddate> <duration>7</duration> <costprice>840</costprice> </date> </dates> </holiday> <holiday> <holidaycode>L4390</holidaycode> <type>Lodge</type> <maxsleeps>6</maxsleeps> <company>LejkHolidays</company> <location>Seaton, Looe, Cornwall</location> <dates> <date> <startdate>10-06-2007</startdate> <enddate>16-06-2007</enddate> <duration>7</duration> <costprice>350</costprice> </date> <date> <startdate>22-07-2007</startdate> <enddate>28-07-2007</enddate> <duration>7</duration> <costprice>620</costprice> </date> <date> <startdate>10-05-2007</startdate> <enddate>12-05-2007</enddate> <duration>3</duration> <costprice>145</costprice> </date> <date> <startdate>23-07-2007</startdate> <enddate>25-07-2007</enddate> <duration>3</duration> <costprice>409</costprice> </date> <date> <startdate>02-09-2006</startdate> <enddate>08-09-2006</enddate> <duration>7</duration> <costprice>293</costprice> </date> </dates> </holiday> <holiday> <holidaycode>CA852</holidaycode> <type>Caravan</type> <maxsleeps>8</maxsleeps> <company>EllmanGetaways</company> <location>Hopton on Sea, Norfolk</location> <dates> <date> <startdate>01-04-2007</startdate> <enddate>07-04-2007</enddate> <duration>7</duration> <costprice>379</costprice> </date> <date> <startdate>10-05-2007</startdate> <enddate>16-05-2007</enddate> <duration>7</duration> <costprice>339</costprice> </date> <date> <startdate>20-08-2007</startdate> <enddate>22-08-2007</enddate> <duration>3</duration> <costprice>829</costprice> </date> <date> <startdate>02-09-2007</startdate> <enddate>08-09-2007</enddate> <duration>7</duration> <costprice>504</costprice> </date> <date> <startdate>15-07-2007</startdate> <enddate>17-07-2007</enddate> <duration>3</duration> <costprice>489</costprice> </date> </dates> </holiday> <holiday> <holidaycode>L9023</holidaycode> <type>Lodge</type> <maxsleeps>8</maxsleeps> <company>EllmanGetaways</company> <location>Darsham, Suffolk</location> <dates> <date> <startdate>03-04-2007</startdate> <enddate>09-04-2007</enddate> <duration>7</duration> <costprice>175</costprice> </date> <date> <startdate>14-05-2007</startdate> <enddate>20-05-2007</enddate> <duration>7</duration> <costprice>256</costprice> </date> <date> <startdate>18-08-2007</startdate> <enddate>20-08-2007</enddate> <duration>3</duration> <costprice>357</costprice> </date> <date> <startdate>05-09-2007</startdate> <enddate>11-09-2007</enddate> <duration>7</duration> <costprice>268</costprice> </date> <date> <startdate>10-07-2007</startdate> <enddate>12-07-2007</enddate> <duration>3</duration> <costprice>276</costprice> </date> </dates> </holiday> <holiday> <holidaycode>C7845</holidaycode> <type>Caravan</type> <maxsleeps>6</maxsleeps> <company>EssexHolidays</company> <location>St Osyth, Clacton-on-Sea, Essex</location> <dates> <date> <startdate>22-04-2007</startdate> <enddate>24-04-2007</enddate> <duration>3</duration> <costprice>204</costprice> </date> <date> <startdate>07-05-2007</startdate> <enddate>13-05-2007</enddate> <duration>7</duration> <costprice>341</costprice> </date> <date> <startdate>26-08-2007</startdate> <enddate>28-08-2007</enddate> <duration>3</duration> <costprice>506</costprice> </date> <date> <startdate>03-09-2007</startdate> <enddate>09-09-2007</enddate> <duration>7</duration> <costprice>451</costprice> </date> <date> <startdate>15-07-2007</startdate> <enddate>21-07-2007</enddate> <duration>7</duration> <costprice>676</costprice> </date> </dates> </holiday> <holiday> <holidaycode>HEB01</holidaycode> <type>Hotel</type> <maxsleeps>2</maxsleeps> <company>Edwardian Grand</company> <location>Oxford Street, London</location> <dates> <date> <startdate>14-11-2006</startdate> <enddate>15-11-2006</enddate> <duration>1</duration> <costprice>185</costprice> </date> <date> <startdate>14-11-2006</startdate> <enddate>16-11-2006</enddate> <duration>2</duration> <costprice>350</costprice> </date> <date> <startdate>26-08-2007</startdate> <enddate>01-09-2007</enddate> <duration>7</duration> <costprice>1200</costprice> </date> </dates> </holiday> <holiday> <holidaycode>H2589</holidaycode> <type>Hotel</type> <maxsleeps>2</maxsleeps> <company>Hotel Mikko</company> <location>Marble Arch, London</location> <dates> <date> <startdate>12-12-2006</startdate> <enddate>13-12-2006</enddate> <duration>1</duration> <costprice>140</costprice> </date> <date> <startdate>22-11-2006</startdate> <enddate>24-11-2006</enddate> <duration>2</duration> <costprice>255</costprice> </date> <date> <startdate>20-08-2007</startdate> <enddate>26-08-2007</enddate> <duration>7</duration> <costprice>900</costprice> </date> </dates> </holiday> <holiday> <holidaycode>H3892</holidaycode> <type>Hotel</type> <maxsleeps>4</maxsleeps> <company>Swansea Inn</company> <location>Swansea</location> <dates> <date> <startdate>12-12-2006</startdate> <enddate>13-12-2006</enddate> <duration>1</duration> <costprice>74</costprice> </date> <date> <startdate>22-11-2006</startdate> <enddate>24-11-2006</enddate> <duration>2</duration> <costprice>130</costprice> </date> <date> <startdate>20-08-2007</startdate> <enddate>26-08-2007</enddate> <duration>7</duration> <costprice>450</costprice> </date> </dates> </holiday> <holiday> <holidaycode>H5840</holidaycode> <type>Hotel</type> <maxsleeps>3</maxsleeps> <company>Burns Hotel</company> <location>Glasgow</location> <dates> <date> <startdate>12-12-2006</startdate> <enddate>13-12-2006</enddate> <duration>1</duration> <costprice>42</costprice> </date> <date> <startdate>18-11-2006</startdate> <enddate>20-11-2006</enddate> <duration>2</duration> <costprice>75</costprice> </date> <date> <startdate>17-09-2007</startdate> <enddate>23-09-2007</enddate> <duration>7</duration> <costprice>280</costprice> </date> </dates> </holiday> </holidays>[/code]
  9. [quote author=redbullmarky link=topic=122081.msg503011#msg503011 date=1168602820] oops sorry. missed a bracket :( [code] if (!isset($_POST['btnList']) || is_null($_POST['btnList'])) [/code] as for the other error, try replacing the $PHP_SELF line with: [code] <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST"> [/code] [b]edit[/b] in fact, if you want the form to post to the CURRENT page, then you dont need to specify a value for action. just [code] <form action="" method="POST"> [/code] would do the same. [/quote] Thank You very much my problem is now solved i used [code]<form action="" method="POST">[/code] and [code]if (!isset($_POST['btnList']) || is_null($_POST['btnList']))[/code] everything is working how it should Cheers, Mal
  10. redbullmarky solution brings up this error Parse error: parse error, unexpected T_BOOLEAN_OR, expecting ',' or ')' in C:\Server\Apache2.2\htdocs\testXpath.php on line 13 any help!
  11. Orio your solution was great the error has gone now, but when i am selecting from the list box then clicking list it is displaying this error [b]Forbidden[/b] You don't have permission to access /<br /><b>Notice</b>: Undefined variable: PHP_SELF in <b>C:/Server/Apache2.2/htdocs/testXpath.php</b> on line <b>18</b><br /> on this server. Any help!
  12. hello i have created a script that will allow a list box to search through an XML file so that it brings up the type of study a student is on. and i am geting this problem: Notice: Undefined index: btnList in C:\Server\Apache2.2\htdocs\Work\cg0119wk10t2.php on line 13 I can workout why this doen't work if anyone could helpm please. The code i am using: [code]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>CG0119 Week 10, Task 2</title> </head> <body> <h1>Student Names by Study Type (using XPath)</h1> <?php if (is_null($_POST['btnList'])) { ?> <form action="<?php echo $PHP_SELF; ?>" method="POST"> List by: <select name = "studyType"> <option value = "U">Undergraduate</option> <option value = "P">Postgraduate</option> <option value = "all">All</option> </select> <input type="submit" value="List" name="btnList" /> </form> <?php } else { // ************************ // *** PROCESS THE FORM *** // ************************ $doc = new DOMDocument; $doc->preserveWhiteSpace = false; $doc->Load('student.xml'); $xpath = new DOMXPath($doc); // Create the query string based on which option the user selected // (start at the root element and include a condition if required). if ($_POST['studyType'] == "P")  { // *** Display postgraduate students *** echo "<h2>Postgraduate Students</h2>\n"; $query = '//students/student/studyTypeID[. = "P"]'; } elseif ($_POST['studyType'] == "U") { // *** Display undergraduate students *** echo "<h2>Undergraduate Students</h2>\n"; $query = '//students/student/studyTypeID[. = "U"]'; } else { // *** Display all students echo "<h2>All Students</h2>\n"; $query = '//students/student/studyTypeID'; } // Execute the query and return a DOMNodeList containing all // of the nodes that match the XPath expression. $entries = $xpath->query($query); echo "<ul>\n"; // Display the required values for each entry returned by the XPath query. foreach ($entries as $entry) { echo "<li>{$entry->previousSibling->previousSibling->nodeValue} {$entry->previousSibling->nodeValue}</li>\n"; } echo "</ul>\n"; } // close the process the form if statement ?> </body> </html>[/code]
  13. hello basiclly i want a list box to be dynamically created where the type of holiday is listed in the list box. i havent got a clue how to do this using XML but i know how to do this using MySQL. here is my XML file (holiday.xml: [code]<?xml version="1.0" ?> <!-- This XML data file contains only a small amount of data. You may insert additional data (providing that it conforms to the tag structure) in order to aid further testing of your code during its development. However, your work will be marked using clean copies of the files provided for use with this assignment (the XML data file holidays.xml and the SQL script HOLIDAYcg0119(Oracle).sql --> <holidays> <holiday> <holidaycode>C1257</holidaycode> <type>Cottage</type> <maxsleeps>8</maxsleeps> <company>Allseasons</company> <location>Fulbeck, Northumberland</location> <dates> <date> <startdate>29-10-2006</startdate> <enddate>31-10-2006</enddate> <duration>3</duration> <costprice>419</costprice> </date> <date> <startdate>12-11-2006</startdate> <enddate>14-11-2006</enddate> <duration>3</duration> <costprice>419</costprice> </date> <date> <startdate>08-04-2007</startdate> <enddate>10-04-2007</enddate> <duration>3</duration> <costprice>621</costprice> </date> <date> <startdate>28-05-2007</startdate> <enddate>04-06-2007</enddate> <duration>5</duration> <costprice>1045</costprice> </date> <date> <startdate>01-08-2007</startdate> <enddate>07-08-2007</enddate> <duration>7</duration> <costprice>1242</costprice> </date> </dates> </holiday> <holiday> <holidaycode>C4981</holidaycode> <type>Cottage</type> <maxsleeps>6</maxsleeps> <company>NewHolidays</company> <location>Old Cornsay, County Durham</location> <dates> <date> <startdate>21-12-2006</startdate> <enddate>27-12-2006</enddate> <duration>7</duration> <costprice>569</costprice> </date> <date> <startdate>14-02-2007</startdate> <enddate>16-02-2007</enddate> <duration>3</duration> <costprice>250</costprice> </date> <date> <startdate>03-06-2007</startdate> <enddate>09-06-2007</enddate> <duration>7</duration> <costprice>427</costprice> </date> <date> <startdate>22-07-2007</startdate> <enddate>24-07-2007</enddate> <duration>3</duration> <costprice>453</costprice> </date> <date> <startdate>16-09-2007</startdate> <enddate>22-09-2007</enddate> <duration>7</duration> <costprice>416</costprice> </date> </dates> </holiday> <holiday> <holidaycode>C2529</holidaycode> <type>Cottage</type> <maxsleeps>4</maxsleeps> <company>DorsetHols</company> <location>North Beaminster, Dorset</location> <dates> <date> <startdate>14-10-2007</startdate> <enddate>20-10-2007</enddate> <duration>7</duration> <costprice>313</costprice> </date> <date> <startdate>20-08-2007</startdate> <enddate>26-08-2007</enddate> <duration>7</duration> <costprice>629</costprice> </date> <date> <startdate>03-01-2007</startdate> <enddate>05-01-2007</enddate> <duration>3</duration> <costprice>569</costprice> </date> <date> <startdate>04-11-2006</startdate> <enddate>10-11-2006</enddate> <duration>7</duration> <costprice>280</costprice> </date> <date> <startdate>10-04-2007</startdate> <enddate>12-04-2007</enddate> <duration>3</duration> <costprice>307</costprice> </date> </dates> </holiday> <holiday> <holidaycode>B2389</holidaycode> <type>Boating</type> <maxsleeps>7</maxsleeps> <company>ElvinBoats</company> <location>River Bure, Horning, Norfolk</location> <dates> <date> <startdate>02-07-2007</startdate> <enddate>08-07-2007</enddate> <duration>7</duration> <costprice>995</costprice> </date> <date> <startdate>19-08-2007</startdate> <enddate>25-08-2007</enddate> <duration>7</duration> <costprice>1242</costprice> </date> <date> <startdate>15-05-2007</startdate> <enddate>17-05-2007</enddate> <duration>3</duration> <costprice>530</costprice> </date> <date> <startdate>25-03-2007</startdate> <enddate>27-03-2007</enddate> <duration>3</duration> <costprice>432</costprice> </date> <date> <startdate>02-09-2007</startdate> <enddate>08-09-2007</enddate> <duration>7</duration> <costprice>978</costprice> </date> </dates> </holiday> <holiday> <holidaycode>B1078</holidaycode> <type>Boating</type> <maxsleeps>6</maxsleeps> <company>FloatingHols</company> <location>River Bure, Wroxham, Norfolk</location> <dates> <date> <startdate>24-06-2007</startdate> <enddate>30-06-2007</enddate> <duration>7</duration> <costprice>682</costprice> </date> <date> <startdate>29-10-2006</startdate> <enddate>31-10-2006</enddate> <duration>3</duration> <costprice>419</costprice> </date> <date> <startdate>15-04-2007</startdate> <enddate>21-04-2007</enddate> <duration>7</duration> <costprice>680</costprice> </date> <date> <startdate>03-06-2007</startdate> <enddate>09-06-2007</enddate> <duration>7</duration> <costprice>853</costprice> </date> <date> <startdate>08-09-2006</startdate> <enddate>10-09-2006</enddate> <duration>3</duration> <costprice>476</costprice> </date> </dates> </holiday> <holiday> <holidaycode>B0988</holidaycode> <type>Boating</type> <maxsleeps>6</maxsleeps> <company>Andersons</company> <location>River Ant, Stalham, Norfolk</location> <dates> <date> <startdate>17-06-2007</startdate> <enddate>23-06-2007</enddate> <duration>7</duration> <costprice>930</costprice> </date> <date> <startdate>22-07-2007</startdate> <enddate>28-07-2007</enddate> <duration>7</duration> <costprice>1190</costprice> </date> <date> <startdate>10-05-2007</startdate> <enddate>12-05-2007</enddate> <duration>3</duration> <costprice>530</costprice> </date> <date> <startdate>23-07-2007</startdate> <enddate>25-07-2007</enddate> <duration>3</duration> <costprice>884</costprice> </date> <date> <startdate>02-09-2006</startdate> <enddate>08-09-2006</enddate> <duration>7</duration> <costprice>840</costprice> </date> </dates> </holiday> <holiday> <holidaycode>L4390</holidaycode> <type>Lodge</type> <maxsleeps>6</maxsleeps> <company>LejkHolidays</company> <location>Seaton, Looe, Cornwall</location> <dates> <date> <startdate>10-06-2007</startdate> <enddate>16-06-2007</enddate> <duration>7</duration> <costprice>350</costprice> </date> <date> <startdate>22-07-2007</startdate> <enddate>28-07-2007</enddate> <duration>7</duration> <costprice>620</costprice> </date> <date> <startdate>10-05-2007</startdate> <enddate>12-05-2007</enddate> <duration>3</duration> <costprice>145</costprice> </date> <date> <startdate>23-07-2007</startdate> <enddate>25-07-2007</enddate> <duration>3</duration> <costprice>409</costprice> </date> <date> <startdate>02-09-2006</startdate> <enddate>08-09-2006</enddate> <duration>7</duration> <costprice>293</costprice> </date> </dates> </holiday> <holiday> <holidaycode>CA852</holidaycode> <type>Caravan</type> <maxsleeps>8</maxsleeps> <company>EllmanGetaways</company> <location>Hopton on Sea, Norfolk</location> <dates> <date> <startdate>01-04-2007</startdate> <enddate>07-04-2007</enddate> <duration>7</duration> <costprice>379</costprice> </date> <date> <startdate>10-05-2007</startdate> <enddate>16-05-2007</enddate> <duration>7</duration> <costprice>339</costprice> </date> <date> <startdate>20-08-2007</startdate> <enddate>22-08-2007</enddate> <duration>3</duration> <costprice>829</costprice> </date> <date> <startdate>02-09-2007</startdate> <enddate>08-09-2007</enddate> <duration>7</duration> <costprice>504</costprice> </date> <date> <startdate>15-07-2007</startdate> <enddate>17-07-2007</enddate> <duration>3</duration> <costprice>489</costprice> </date> </dates> </holiday> <holiday> <holidaycode>L9023</holidaycode> <type>Lodge</type> <maxsleeps>8</maxsleeps> <company>EllmanGetaways</company> <location>Darsham, Suffolk</location> <dates> <date> <startdate>03-04-2007</startdate> <enddate>09-04-2007</enddate> <duration>7</duration> <costprice>175</costprice> </date> <date> <startdate>14-05-2007</startdate> <enddate>20-05-2007</enddate> <duration>7</duration> <costprice>256</costprice> </date> <date> <startdate>18-08-2007</startdate> <enddate>20-08-2007</enddate> <duration>3</duration> <costprice>357</costprice> </date> <date> <startdate>05-09-2007</startdate> <enddate>11-09-2007</enddate> <duration>7</duration> <costprice>268</costprice> </date> <date> <startdate>10-07-2007</startdate> <enddate>12-07-2007</enddate> <duration>3</duration> <costprice>276</costprice> </date> </dates> </holiday> <holiday> <holidaycode>C7845</holidaycode> <type>Caravan</type> <maxsleeps>6</maxsleeps> <company>EssexHolidays</company> <location>St Osyth, Clacton-on-Sea, Essex</location> <dates> <date> <startdate>22-04-2007</startdate> <enddate>24-04-2007</enddate> <duration>3</duration> <costprice>204</costprice> </date> <date> <startdate>07-05-2007</startdate> <enddate>13-05-2007</enddate> <duration>7</duration> <costprice>341</costprice> </date> <date> <startdate>26-08-2007</startdate> <enddate>28-08-2007</enddate> <duration>3</duration> <costprice>506</costprice> </date> <date> <startdate>03-09-2007</startdate> <enddate>09-09-2007</enddate> <duration>7</duration> <costprice>451</costprice> </date> <date> <startdate>15-07-2007</startdate> <enddate>21-07-2007</enddate> <duration>7</duration> <costprice>676</costprice> </date> </dates> </holiday> <holiday> <holidaycode>HEB01</holidaycode> <type>Hotel</type> <maxsleeps>2</maxsleeps> <company>Edwardian Grand</company> <location>Oxford Street, London</location> <dates> <date> <startdate>14-11-2006</startdate> <enddate>15-11-2006</enddate> <duration>1</duration> <costprice>185</costprice> </date> <date> <startdate>14-11-2006</startdate> <enddate>16-11-2006</enddate> <duration>2</duration> <costprice>350</costprice> </date> <date> <startdate>26-08-2007</startdate> <enddate>01-09-2007</enddate> <duration>7</duration> <costprice>1200</costprice> </date> </dates> </holiday> <holiday> <holidaycode>H2589</holidaycode> <type>Hotel</type> <maxsleeps>2</maxsleeps> <company>Hotel Mikko</company> <location>Marble Arch, London</location> <dates> <date> <startdate>12-12-2006</startdate> <enddate>13-12-2006</enddate> <duration>1</duration> <costprice>140</costprice> </date> <date> <startdate>22-11-2006</startdate> <enddate>24-11-2006</enddate> <duration>2</duration> <costprice>255</costprice> </date> <date> <startdate>20-08-2007</startdate> <enddate>26-08-2007</enddate> <duration>7</duration> <costprice>900</costprice> </date> </dates> </holiday> <holiday> <holidaycode>H3892</holidaycode> <type>Hotel</type> <maxsleeps>4</maxsleeps> <company>Swansea Inn</company> <location>Swansea</location> <dates> <date> <startdate>12-12-2006</startdate> <enddate>13-12-2006</enddate> <duration>1</duration> <costprice>74</costprice> </date> <date> <startdate>22-11-2006</startdate> <enddate>24-11-2006</enddate> <duration>2</duration> <costprice>130</costprice> </date> <date> <startdate>20-08-2007</startdate> <enddate>26-08-2007</enddate> <duration>7</duration> <costprice>450</costprice> </date> </dates> </holiday> <holiday> <holidaycode>H5840</holidaycode> <type>Hotel</type> <maxsleeps>3</maxsleeps> <company>Burns Hotel</company> <location>Glasgow</location> <dates> <date> <startdate>12-12-2006</startdate> <enddate>13-12-2006</enddate> <duration>1</duration> <costprice>42</costprice> </date> <date> <startdate>18-11-2006</startdate> <enddate>20-11-2006</enddate> <duration>2</duration> <costprice>75</costprice> </date> <date> <startdate>17-09-2007</startdate> <enddate>23-09-2007</enddate> <duration>7</duration> <costprice>280</costprice> </date> </dates> </holiday> </holidays>[/code] If anyone could help please Thanks, Mal
  14. I have to use HTTP authentication it is part of the requirments for my assignment for university, i would normally use php sessions so i am trying to use http authentication in the same way as sessions, i know it is possible because i have seen a friends HTTP authentication and it is setup like that, but i can't ask how he done it has it could be classed as copying. thanks for the help anyway Mal
  15. i just want to be able to login so i can access the restricted parts of my site and i need to use HTTP Authentication. the index page will not be protected just have the function on to login so the restricted parts of my site can be accessed. the Popup box is generated by this code: [code]if (!isset($_SERVER['PHP_AUTH_USER'])) { // Display the logon dialog box. header('WWW-Authenticate: Basic realm="CG0119 Student Record System"'); header('HTTP/1.0 401 Unauthorized'); // If the user has clicked the 'cancel' button display appropriate messages and exit echo "<h1>Student Record System: Logon Failure</h1>\n"; echo "<p><strong>The [Cancel] button was clicked - the logon process has been stopped.</strong></p>\n"; exit; } else {[/code] It pops up and you enter username and password Thanks, Mal
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.