Jump to content

AnotherQuestion

Members
  • Posts

    28
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

AnotherQuestion's Achievements

Member

Member (2/5)

0

Reputation

  1. tried that & got: Warning: Invalid argument supplied for foreach()
  2. What I would like to happen is: User selects a description from a SelectMenu. On Select they post the form using GET method. When the page is posted back the user then gets alist of the items they have selected ( A mini shopping cart). so far I have $Bookings=array($Bookings,$_GET['BookingID']); $_SESSION['ServicesReqID'] = $Bookings; and the ECHO looks like foreach($_SESSION['ServicesReqID'] as $key=>$value) { echo $key.$value; } All that happens is the last array changes value instead of adding on
  3. worked it out $xmlDoc = new DOMDocument(); $xmlDoc->load("Vrmdata.xml"); $x = $xmlDoc->documentElement; foreach ($x->childNodes AS $item) { $_SESSION[$item->nodeName] = $item->nodeValue ; } $_SESSION['RegNo'] = $_SESSION['Vrm'];
  4. Thanks for that I have tried the following code but not working as I mentioned earlier I am trying to read an xml file then set each of the tag names to a session variable and then set the data of the tags to the session name eg XML output <VRM>AMS1</VRM> would become: $_SESSION['VRM'] = "AMS1" etc. : (please see below for XML output $data = file_get_contents("https://vrm.mamsoft.co.uk/vrmlookup/vrmlookup.asmx/Find?Username=NOSPAM&Password=NOSPAM&Vrm=".$_GET['RegNo']); $FileName = "Vrmdata.xml"; $VrmFile = fopen($FileName, 'w')or die("can't open file"); fwrite($VrmFile, $data); fclose($VrmFile); //Initialize the XML parser $parser=xml_parser_create(); //Function to use at the start of an element function start($parser,$element_name,$element_attrs) { switch($element_name) { } } //Function to use at the end of an element function stop($parser,$element_name) { } //Function to use when finding character data function char($parser,$data) { $_SESSION[$element_name] = $data; } //Specify element handler xml_set_element_handler($parser,"start","stop"); //Specify data handler xml_set_character_data_handler($parser,"char"); //Open XML file $fp=fopen("Vrmdata.xml","r"); //Read data while ($data=fread($fp,4096)) { xml_parse($parser,$data,feof($fp)) or die (sprintf("XML Error: %s at line %d", xml_error_string(xml_get_error_code($parser)), xml_get_current_line_number($parser))); } //Free the XML parser xml_parser_free($parser); The output of the above file gives a result like: <?xml version="1.0" encoding="utf-8"?> <ReturnValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xsi:type="Vehicle" xmlns="www.mamsoft.co.uk/VrmLookup"> <Vrm></Vrm> <Vin></Vin> <EngineNo></EngineNo> <EngineSize></EngineSize> <EngineModel></EngineModel> <Fuel></Fuel> <Make></Make> <Model></Model> <Colour></Colour> <Transmission>C</Transmission> <TransmissionCode></TransmissionCode> <BodyPlan></BodyPlan> <Gears></Gears> <YearOfManufacture></YearOfManufacture> <DateRegistered></DateRegistered> <Scrapped></Scrapped> <Exported></Exported> <Imported></Imported> <DtpMakeCode></DtpMakeCode> <DtpModelCode></DtpModelCode> </ReturnValue>
  5. I am trying to read an xml file and set the tags of the xml file to session variables. I would like to know how to set a session variable name eg $tagname $_SESSION['$tagname'] = "WHATEVER" ; Thanks
  6. I thought id try placing the TRUE & FALSE into 'TRUE' and 'FALSE' still dosent work unset($_SESSION['Normal']); unset($_SESSION['LargeEngine']); unset($_SESSION['EngineLarge']); unset($_SESSION['EngineSpecial']); unset($_SESSION['MakeSpecial']); unset($_SESSION['Special']); $_SESSION['Normal'] = 'TRUE'; If ($_SESSION['EngineSize'] >=2000) {$_SESSION['EngineSpecial'] = 'TRUE';} If ($_SESSION['Make'] == 'BMW') {$_SESSION['MakeSpecial'] = 'TRUE';} If ($_SESSION['Make'] == 'MERCEDES') {$_SESSION['MakeSpecial'] = 'TRUE';} If ($_SESSION['EngineSize'] >=3000) {$_SESSION['EngineLarge'] = 'TRUE'; $_SESSION['Normal'] = 'FALSE'; } If (($_SESSION['$MakeSpecial'] == 'TRUE') AND ($_SESSION['$EngineSpecial'] == 'TRUE')) { $_SESSION['Special'] = 'TRUE'; $_SESSION['Normal'] = 'FALSE'; } If ($_SESSION['FourWheelDrive'] = "Yes") {$_SESSION['Normal'] = 'FALSE'; } If ($_SESSION['Normal'] == 'TRUE') { $URL="http://www.u.com/Quote/GiltQuoteResult1.php"; header ("Location: $URL"); } ElseIf ($_SESSION['Special'] == 'TRUE') { $URL="http://www.nty.com/Quote/GiltQuoteResult2.php"; header ("Location: $URL"); } ElseIf ($_SESSION['FourWheelDrive'] == "Yes") { $URL="http://www..com/Quote/GiltQuoteResult3.php"; header ("Location: $URL"); } ElseIf ($_SESSION['LargeEngine'] == 'TRUE') { $URL="http://www.u.com/Quote/GiltQuoteResult4.php"; header ("Location: $URL"); }
  7. I have removed the $and still no joy. it always goes to ElseIf ($_SESSION['Special'] == TRUE) { $URL="http://www./Quote/GoldQuoteResult1.php"; header ("Location: $URL"); }
  8. I have changed the code and it still doesnt't work. unset($_SESSION['Normal']); unset($_SESSION['LargeEngine']); unset($_SESSION['EngineLarge']); unset($_SESSION['EngineSpecial']); unset($_SESSION['MakeSpecial']); unset($_SESSION['Special']); If ($_SESSION['EngineSize'] >=2000) {$_SESSION['EngineSpecial'] = TRUE;} If ($_SESSION['Make'] == 'BMW') {$_SESSION['$MakeSpecial'] = TRUE;} If ($_SESSION['Make'] == 'MERCEDES') {$_SESSION['$MakeSpecial'] = TRUE;} If ($_SESSION['EngineSize'] >=3000) {$_SESSION['EngineLarge'] = TRUE; $_SESSION['Normal'] = FALSE; } If (($_SESSION['$MakeSpecial'] == TRUE) AND ($_SESSION['$EngineSpecial'] == TRUE)) { $_SESSION['Special'] = TRUE; $_SESSION['Normal'] = FALSE; } If ($_SESSION['FourWheelDrive'] = "Yes") {$_SESSION['Normal'] = FALSE; } If ($_SESSION['Normal'] == TRUE) { $URL="http://www.ultom/Quote/GoldQuoteResult.php"; header ("Location: $URL"); } ElseIf ($_SESSION['Special'] == TRUE) { $URL="http://www./Quote/GoldQuoteResult1.php"; header ("Location: $URL"); } ElseIf ($_SESSION['FourWheelDrive'] == "Yes") { $URL="http://www.ult/Quote/GoldQuoteResult2.php"; header ("Location: $URL"); } ElseIf ($_SESSION['LargeEngine'] == TRUE) { $URL="http://www.ulti/Quote/GoldQuoteResult3.php"; header ("Location: $URL"); }
  9. can you post the code please? Simple Send mail syntax>>>> on your form for example: textbox: email textbox:Message action="Sendmail.php" onyour sendmail.php form>>>> <?php $email = $_REQUEST['email'] ; $message = $_REQUEST['message'] ; mail( "yourname@example.com", "Your Feedback", $message, "From: $email" ); header( "Location: http://yournextformtoshow.com/next.php" ); ?>
  10. I cant find out how to do this in php or if it is possible. If not can anyone suggest? When user selects Five check boxes an image shows: Thanks P.s. I would normally post some code but I have no idea in php. In asp.net it would be something like If Chkbox1.Checkbox = True AND....... Then ...do this
  11. LargeEngine:TRUE Special:TRUE 4x4:FALSE Normal:FALSE
  12. Did a test with form. array(6) { ["RegNo"]=> string(7) "Ck57HZZ" ["Make"]=> string(3) "BMW" ["Model"]=> string(4) "318i" ["EngineSize"]=> string(4) "3000" ["4wdNo"]=> string(2) "on" ["Next"]=> string(4) "Next" } with these results it should set $Session['Special'] ="True" and goto goldquote3.php instead it goes to line 37 --> goldquote2.php
  13. I have changed the = to == and it still fails to work.
  14. I have a script which is supposed to take user to different pages depending on their input on a previous form. I have checked that the correcr values are getting to this code. $_SESSION['Normal']= "TRUE"; $_SESSION['RegNo'] = $_GET['RegNo']; $_SESSION['Make'] = $_GET['Make']; $_SESSION['Model'] =$_GET['Model']; $_SESSION['EngineSize'] =$_GET['EngineSize']; If ($_GET['4wdYes'] = 'on') { $_SESSION['FourWheelDrive'] = "TRUE" ; $_SESSION['Normal']= "FALSE"; } If ($_GET['4wdNo'] = 'on') { $_SESSION['FourWheelDrive'] = "FALSE" ; $_SESSION['Normal']= "FALSE"; } If ($_SESSION['EngineSize'] >= '3000') { $_SESSION['LargeEngine'] ="TRUE"; $_SESSION['Normal']= "FALSE"; } If ($_SESSION['Make'] == 'BMW'){$_SESSION['MakeCheck'] = "TRUE";} If ($_SESSION['Make'] == 'MERCEDES') {$_SESSION['MakeCheck'] = "TRUE";} If ( ($_SESSION['MakeCheck'] =="TRUE") AND ($_SESSION['EngineSize'] >='2000') ) { $_SESSION['Special'] = "TRUE"; $_SESSION['Normal']= "FALSE"; } If ($_SESSION['Normal'] = "TRUE") { $URL="http://www.ultimatblablay.com/Quotes/GoldQuote2.php"; header ("Location: $URL"); } ElseIf ($_SESSION['Special'] = "TRUE") { $URL="http://www.ultimateblablanty.com/Quotes/GoldQuote3.php"; header ("Location: $URL"); } ElseIf ($_SESSION['LargeEngine'] = "TRUE") { $URL="http://www.ultimatevehiclanty.com/Quotes/GoldQuote4.php"; header ("Location: $URL"); } Else { $URL="http://www.ultimablaba.com/Quotes/GoldQuote5.php"; header ("Location: $URL"); } ?> However it always sends users to the same place goldquote2. The first line
  15. I have tried the following code If ($_SESSION['MakeCheck'] =="TRUE") AND ($_SESSION['EngineSizeCheck'] >='2000') {$_SESSION['SpecialOver2000'] = "TRUE";} But get an error: Parse error: syntax error, unexpected T_LOGICAL_AND I have search all over how to join logical AND in php and cant get anywhere.
×
×
  • 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.