Jump to content

Malcolmhire2001

Members
  • Posts

    26
  • Joined

  • Last visited

    Never

Everything posted by Malcolmhire2001

  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
  16. Hello, i Have to create pages with HTTP Authentication for security, i can get the HTTP authentication working with the IE popup box that requests for username and password. but what i am wanting to do is to be able to enter username and password on the index page of my website then login from there instead of using the IE popup box thing. if anyone could help it would be great Thanks, Mal This is the code i have at the min but i don't work [code]<?php // *************************** // *** HTTP AUTHENTICATION *** // *************************** { $customerid = $_POST['customerid']; $password = $_POST['password']; } { // Connect to the Oracle database $conn = OCILogon("p950278","password","//127.0.0.1/XE") or die("<strong>ERROR:</strong> Connection to the Oracle database failed. Please contact the system administrator"); // Validate the user. $sql = "SELECT * FROM customer WHERE lower(customerid) = lower('{$_SERVER['PHP_AUTH_USER']}') AND lower(password) = lower('{$_SERVER['PHP_AUTH_PW']}')"; // Parse the SQL statement. $stmt = OCIParse($conn, $sql); // Execute / run the query. OCIExecute($stmt); OCIFetch($stmt); // If no rows were returned the username and password are invalid. // Display a message to the user and exit the script. if (oci_num_rows($stmt) == 0) { echo "<h1>Student Record System: Logon Failure</h1>\n"; echo "<p>Either the username or password that was entered was incorrect. \n"; echo "The logon was unsuccessful.</p>\n"; $_SERVER['PHP_AUTH_USER'] = "UNAUTHORISED"; exit; } } ?> <!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>Uk Holidays</title> <link href="mystyle.css" rel="stylesheet" type="text/css"> <script language="javascript" type="text/javascript" src="datetimepicker.js"> </script> <style type="text/css"> <!-- .style1 { color: #FFFFFF; font-weight: bold; } .style5 {color: #FFFFFF; font-weight: bold; font-size: 12px; } .style6 { font-size: 12px; color: #000000; } .style8 {font-size: 11px} --> </style> </head> <body> <?php if (!isset($_GET['page'])) {         $url="index.php?page=home"; header("Location: ".$url); exit; } else { $page = $_GET['page']; } ?> <?php $today = date("d-m-y"); ?>                        <table width="800" height="81%"  border="0" cellpadding="0" cellspacing="0">   <tr>     <td height="111" rowspan="2"><div align="left"><img src="images/logo.jpg" width="207" height="93"></div></td>     <td height="63" colspan="5" valign="top" background="images/topbar.jpg"> <form name="form1" method="post" action="">         <p align="right" class="style6"><br>           Username:           <input name="customerid" type="text" id="customerid" size="15">           Password:           <input name="password" type="password" id="password" size="15">           <input name="login" type="submit" id="login" value="Login">         </p>     </form></td>   </tr>   <tr>     <td height="18" colspan="5" valign="bottom" background="images/topbar.jpg"><div align="right">           </div></td>   </tr>   <tr>     <td height="18" valign="top">&nbsp;</td>     <td colspan="5" valign="top">&nbsp;</td>   </tr>   <tr>     <td width="255" height="792" rowspan="2" valign="top"><form action="" method="post" name="holsearch" id="holsearch">         <div align="left">           <table width="100%" height="385"  border="0" id="holiday">             <tr>               <td height="31" colspan="3"><div align="left"><span class="style1"><img src="images/searchtop.jpg" width="100%" height="32"></span></div></td>             </tr>             <tr>               <td bgcolor="#3892C6"><span class="style5">Type</span></td>               <td colspan="2" bgcolor="#8CBFDE"><select name="type" id="type">                 <option>Cottage</option>                 <option>Boat</option>               </select></td>             </tr>             <tr>               <td width="35%" bgcolor="#3892C6"><span class="style5">Destination</span></td>               <td colspan="2" bgcolor="#8CBFDE"><select name="destination" id="destination">               </select></td>             </tr>             <tr>               <td bgcolor="#3892C6"><span class="style5">Check In </span></td>               <td width="41%" bgcolor="#8CBFDE"><input type="text" id="startdate" value="<?php echo "$today"?>" size="15"></td>               <td width="24%" bgcolor="#8CBFDE"><a href="javascript:NewCal('startdate','ddmmyyyy')"><img src="cal.gif" width="16" height="16" border="0" alt="Pick a date"></a></td>             </tr>             <tr>               <td bgcolor="#3892C6"><span class="style5">Check Out</span></td>               <td bgcolor="#8CBFDE"><input id="enddate" type="text" size="15"></a></td>               <td width="24%" bgcolor="#8CBFDE"><a href="javascript:NewCal('enddate','ddmmyyyy')"><img src="cal.gif" width="16" height="16" border="0" alt="Pick a date"></a></td>             </tr>             <tr>               <td bgcolor="#3892C6"><span class="style5">Rooms</span></td>               <td colspan="2" bgcolor="#8CBFDE"><select name="rooms" id="rooms">                 <option value="1">1</option>                 <option value="2">2</option>                 <option value="3">3</option>                 <option value="4">4</option>                 <option value="5">5</option>               </select></td>             </tr>             <tr>               <td bgcolor="#3892C6"><span class="style5">Adult</span></td>               <td colspan="2" bgcolor="#8CBFDE"><select name="adult" id="adult">                 <option value="1">1</option>                 <option value="2">2</option>                 <option value="3">3</option>                 <option value="4">4</option>                 <option value="5">5</option>                 <option value="6">6</option>                 <option value="7">7</option>                 <option value="8">8</option>                 <option value="9">9</option>                 <option value="10">10</option>               </select></td>             </tr>             <tr>               <td bgcolor="#3892C6"><span class="style5">Children</span></td>               <td colspan="2" bgcolor="#8CBFDE"><select name="children" id="children">                 <option value="1">1</option>                 <option value="2">2</option>                 <option value="3">3</option>                 <option value="4">4</option>                 <option value="5">5</option>                 <option value="6">6</option>                 <option value="7">7</option>                 <option value="8">8</option>                 <option value="9">9</option>                 <option value="10">10</option>               </select></td>             </tr>             <tr>               <td bgcolor="#3892C6"><span class="style5">Price Min</span></td>               <td colspan="2" bgcolor="#8CBFDE"><span class="style1">                 <select name="min" id="min">                   <option value="200">&pound;200</option>                   <option value="300">&pound;300</option>                   <option value="400">&pound;400</option>                   <option value="500">&pound;500</option>                   <option value="600">&pound;600</option>                   <option value="700">&pound;700</option>                   <option value="800">&pound;800</option>                   <option value="900">&pound;900</option>                   <option value="1000">&pound;1000</option>                   <option value="1100">&pound;1100</option>                   <option value="1200">&pound;1200</option>                 </select>               </span></td>             </tr>             <tr>               <td bgcolor="#3892C6"><span class="style5">Price Max</span></td>               <td colspan="2" bgcolor="#8CBFDE"><select name="max" id="max">                 <option value="400">&pound;400</option>                 <option value="600">&pound;600</option>                 <option value="800">&pound;800</option>                 <option value="1000">&pound;1000</option>                 <option value="1200">&pound;1200</option>                 <option value="1400">&pound;1400</option>                 <option value="1600">&pound;1600</option>               </select></td>             </tr>             <tr>               <td colspan="3" bgcolor="#3892C6"><div align="center"><input type="image" name="Send" alt="Send" value="Send" src="images/searchbutton.gif"> </div></td>             </tr>             <tr>               <td height="30" colspan="3"><img src="images/searchbottom.jpg" width="100%" height="32"></td>             </tr>           </table>         </div>         </form>     </td>     <td height="792" colspan="5" valign="top" background="images/topbar.jpg">      <?php if(file_exists($page.'.php')) {   include $page.'.php'; } else { echo "No Page Exists"; } ?>      </td>   </tr>   <tr>     <td width="126" valign="top" background="images/topbar.jpg"><span class="style8">Brochure Request</span></td>     <td width="119" valign="top" background="images/topbar.jpg"><span class="style8">Help And FAQ </span></td>     <td width="112" valign="top" background="images/topbar.jpg"><span class="style8">Terms of Use </span></td>     <td width="98" valign="top" background="images/topbar.jpg"><span class="style8">About Us </span></td>     <td width="90" valign="top" background="images/topbar.jpg"><span class="style8">Site Map </span></td>   </tr> </table> </body> </html> [/code]
  17. Thats great, used javascrip and its workin great now exacly what i wanted thanks for your help Mal
  18. Hello, i am creating a holiday website for university and all i want to do is when i click on a date on my calander it inserts that date into the the date field on my seach holiday form. i am using a the calander created from here [url=http://www.phpfreaks.com/tutorials/83/0.php]http://www.phpfreaks.com/tutorials/83/0.php[/url] If anyone could help? Thanks, Malcolm
  19. hello i would like to create a duynamic Login/Logout link at the top of all my pages so if the user is not logged in it displays a login link but if the user is logged in it displays a logout link does anyone know how i would go about this? thanks, Malcolm
  20. i solved the problem i stupidly had no data in the SQL table [img src=\"style_emoticons/[#EMO_DIR#]/laugh.gif\" style=\"vertical-align:middle\" emoid=\":laugh:\" border=\"0\" alt=\"laugh.gif\" /] thanks anyway
  21. Hello, i am trying to make a form where you can select a member from a combo box then you would be able to edit there details, using a while loop. all that is happening is that it there is a empty combo box and the button heres my code: [code] <?php     include("connection.inc.php");     $connection = connect();     $sql = "SELECT membership_no, forename, surname, address_1, address_2, post_code, telephone_no                 FROM tbl_members                 ORDER BY surname";     $result = @mysql_query($sql) or die (mysql_error());     $option_block = "";          while ($row = mysql_fetch_array($result))     {                     $membership_no = $row['membership_no'];         $forename = $row['forename'];                     $surname = $row['surname'];         $address_1 = $row['address_1'];         $address_2 = $row['address_2'];         $postcode = $row['post_code'];         $telephone_no = $row['telephone_no'];              $option_block .= "<option value=\"$membership_no\"> $membership_no, $forename, $surname, $address_1, $address_2, $post_code, $telephone_no</option>";     }     $display_block = "         <FORM METHOD=\"post\" ACTION=\"index.php?page=show_existing.php\">         <P><strong>Contact:</strong>         <select name=\"membership_no\">                 $option_block         </select>         <INPUT TYPE=\"SUBMIT\" NAME=\"submit\" VALUE=\"Select this Member\"></P>         </form>         "; ?> <HTML> <HEAD> <TITLE>User Management</TITLE> </HEAD> <BODY> <h1>User Management</h1> <h3>Modify a User</h3> <P>Select a user from the list below, to modify the user's record.</p> <? echo "$display_block"; ?> </BODY> </HTML> [/code] Thanks to anyone that can help Malcolm
  22. thanks for your help i'v tried the Caesar solution and that make the warning errors disapper but it still isn't wat i want the site to do. i have also tried wildteen88 solution and that works to some extent i now have these errors when clicking on a page that needs you to login to view the page. [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--] Notice: Undefined index: admin_ID in C:\Server\Apache2\htdocs\Rockcliff Rugby Club\bookings.php on line 2 Warning: Cannot modify header information - headers already sent by (output started at C:\Server\Apache2\htdocs\Rockcliff Rugby Club\index.php:15) in C:\Server\Apache2\htdocs\Rockcliff Rugby Club\bookings.php on line 4 [/quote] this is supposed to take you back to the login page because you are not logged in the code used for this page [code] <?php if (!$_SESSION['admin_ID'])     {         header("Location: index.php?page=login");         exit;     }     else     {         $admin_ID = $_SESSION['admin_ID'];     } ?> Bookings [/code] the login form is workin fine now without any errors thanks for your help if you could help me with this last problem it would be great. thank you, Malcolm
  23. i have tried that tread but everything within my code seems fine. also the code for the session is placed at the top of every session page like it says in the tread thanks, malcolm
  24. Hello i'm i'm busy building a website using Tables, i am trying to create a login with sessions but i get the error: [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\Server\Apache2\htdocs\Rockcliff Rugby Club\index.php:13) in C:\Server\Apache2\htdocs\Rockcliff Rugby Club\logged_in.php on line 2 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\Server\Apache2\htdocs\Rockcliff Rugby Club\index.php:13) in C:\Server\Apache2\htdocs\Rockcliff Rugby Club\logged_in.php on line 2 Welcome hirem You have successfully logged in [/quote] this error is when you login! when i try to go to a page which requires me to be in a session and i am not i a session i get this error: [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\Server\Apache2\htdocs\Rockcliff Rugby Club\index.php:13) in C:\Server\Apache2\htdocs\Rockcliff Rugby Club\bookings.php on line 2 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\Server\Apache2\htdocs\Rockcliff Rugby Club\index.php:13) in C:\Server\Apache2\htdocs\Rockcliff Rugby Club\bookings.php on line 2 Notice: Undefined index: admin_ID in C:\Server\Apache2\htdocs\Rockcliff Rugby Club\bookings.php on line 3 Warning: Cannot modify header information - headers already sent by (output started at C:\Server\Apache2\htdocs\Rockcliff Rugby Club\index.php:13) in C:\Server\Apache2\htdocs\Rockcliff Rugby Club\bookings.php on line 5 [/quote] these are my pages i am using: index.php [code] <?php if (!isset($_GET['page'])) {         $url="index.php?page=home";         header("Location: /Rockcliff Rugby Club/".$url);         exit; } else { $page = $_GET['page']; } ?> <style type="text/css"> <!-- body {     background-color: #EFEBDE; } .style1 {     font-size: 24px;     font-family: Verdana, Arial, Helvetica, sans-serif; } --> </style> <script language="JavaScript" type="text/JavaScript"> <!-- function MM_swapImgRestore() { //v3.0   var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; } function MM_findObj(n, d) { //v4.01   var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {     d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}   if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];   for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);   if(!x && d.getElementById) x=d.getElementById(n); return x; } function MM_swapImage() { //v3.0   var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)    if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} } function MM_preloadImages() { //v3.0   var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();     var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)     if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} } function MM_nbGroup(event, grpName) { //v6.0   var i,img,nbArr,args=MM_nbGroup.arguments;   if (event == "init" && args.length > 2) {     if ((img = MM_findObj(args[2])) != null && !img.MM_init) {       img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;       if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();       nbArr[nbArr.length] = img;       for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {         if (!img.MM_up) img.MM_up = img.src;         img.src = img.MM_dn = args[i+1];         nbArr[nbArr.length] = img;     } }   } else if (event == "over") {     document.MM_nbOver = nbArr = new Array();     for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {       if (!img.MM_up) img.MM_up = img.src;       img.src = (img.MM_dn && args[i+2]) ? args[i+2] : ((args[i+1])? args[i+1] : img.MM_up);       nbArr[nbArr.length] = img;     }   } else if (event == "out" ) {     for (i=0; i < document.MM_nbOver.length; i++) {       img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }   } else if (event == "down") {     nbArr = document[grpName];     if (nbArr)       for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; }     document[grpName] = nbArr = new Array();     for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {       if (!img.MM_up) img.MM_up = img.src;       img.src = img.MM_dn = (args[i+1])? args[i+1] : img.MM_up;       nbArr[nbArr.length] = img;   } } } //--> </script> <body onLoad="MM_preloadImages('buttons/Login_over.gif','buttons/bookings_over.gif','buttons/aboutus_over.gif','buttons/contactus_over.gif','buttons/members_over.gif')"> <table width="800" height="613" border="0" align="center" cellpadding="0" cellspacing="0">   <tr>     <td height="69"><div align="center" class="style1"><img src="buttons/title.gif" width="800" height="94"></div></td>   </tr>   <tr>     <td height="28" bgcolor="#D6CFA5"><div align="center">         <table border="0" cellpadding="0" cellspacing="0">           <tr bordercolor="#000000" bgcolor="#D1CFA7">             <td><a href="?page=login" target="_top" onClick="MM_nbGroup('down','group1','login','buttons/Login_over.gif',1)" onMouseOver="MM_nbGroup('over','login','buttons/Login_over.gif','',1)" onMouseOut="MM_nbGroup('out')"><img src="buttons/Login_up.gif" alt="Login" name="login" border="0" onload=""></a></td>             <td><a href="?page=members" target="_top" onClick="MM_nbGroup('down','group1','members','buttons/members_over.gif',1)" onMouseOver="MM_nbGroup('over','members','buttons/members_over.gif','',1)" onMouseOut="MM_nbGroup('out')"><img src="buttons/members_up.gif" alt="Register" name="members" border="0" onload=""></a></td>             <td><a href="?page=bookings" target="_top" onClick="MM_nbGroup('down','group1','bookings','buttons/bookings_over.gif',1)" onMouseOver="MM_nbGroup('over','bookings','buttons/bookings_over.gif','',1)" onMouseOut="MM_nbGroup('out')"><img name="bookings" src="buttons/bookings_up.gif" border="0" alt="Bookings" onload=""></a></td>             <td><a href="?page=about_us" target="_top" onClick="MM_nbGroup('down','group1','about_us','buttons/aboutus_over.gif',1)" onMouseOver="MM_nbGroup('over','about_us','buttons/aboutus_over.gif','',1)" onMouseOut="MM_nbGroup('out')"><img name="about_us" src="buttons/aboutus_up.gif" border="0" alt="About Us" onload=""></a></td>             <td><a href="?page=contact_us" target="_top" onClick="MM_nbGroup('down','group1','Contact_us','buttons/contactus_over.gif',1)" onMouseOver="MM_nbGroup('over','Contact_us','buttons/contactus_over.gif','',1)" onMouseOut="MM_nbGroup('out')"><img name="Contact_us" src="buttons/contactus_up.gif" border="0" alt="Contact Us" onload=""></a></td>           </tr>         </table>     </div></td>   </tr>   <tr>     <td valign="top"> <?php if(file_exists($page.'.php')) {   include $page.'.php'; } else { echo "No Page Exists"; } ?>     </td>   </tr> </table> [/code] login_php.php [code] <?php session_start(); include("connection.inc.php"); $connection = connect(); $admin_ID = $_POST['admin_ID']; $password = $_POST['password']; if ((!$admin_ID) || (!$password))     {     header("Location: index.php?page=login");     exit; } $sql = "SELECT * FROM tbl_admin_members WHERE admin_ID = '$admin_ID' AND password = '$password'"; $result = @mysql_query($sql) or die ("Unable to run query"); $count = mysql_num_rows($result);     if ($count !=0)     {         $_SESSION['admin_ID'] = $admin_ID;         header ("Location: index.php?page=logged_in");     }     else     {         $msg = "<p>Your username or password was invalid,         please click the hyperlink below and try again <br><a href= index.php?page=login>Login</a></br></p>";     } ?> <html> <head>   <title>Logged In</title> </head> <body> <?php echo "$msg"; ?> </body> </html> [/code] bookings.php [code] <?php     session_start(); if (!$_SESSION['admin_ID'])     {         header("Location: index.php?page=login");         exit;     }     else     {         $admin_ID = $_SESSION['admin_ID'];     } ?> Bookings [/code] If someone could please help i would be very greatful thanks, Malcolm
×
×
  • 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.