Jump to content

malkocoglu

Members
  • Posts

    32
  • Joined

  • Last visited

Everything posted by malkocoglu

  1. I get it now. Brilliant idea. Thank you guys.....
  2. Thank you guys for prompt answer. The difficulty I will have with that is that I say saloon car can take 2 large 1 small which is 3 suitcases. If I allow them to choose 3 suitcases in total then they could choose 3 large suitcase which will not fit in a saloon car. Hope it makes sense...
  3. Hello All, I need to figure out a way to get a value from data base. The difficulty is that the query will be based on a form request. I have a table called VEHICLES. And I need to pull all values using the data from submitted form field of passengers, large_bags, small_bags by visitor. This table contains different vehicles like a Saloon car which can take up to 4 passengers, 2 large bags and 1 small bag So Example. If a visitor Selects 2 Passengers, 2 Large Bags and 0 Small Bags. It should only pull the vehicle which can take 2 Passengers, 2 Large Bags. current code I have is like this which only selects a specific value from the table. It does not SELECT * FROM vehicles WHERE passengers ='$passengers' AND large_case='$large_bags' AND small_case='$small_bags' This will only return the value according to what ever the visitor select and because of that 32 Saloon vehicle needs to be created which is not practical. I need to make a code that calculates the option using the values from the form and pulls only the vehicle which is suitable for the entered value Example: We have following vehicles; Salooon => up to 4 Passengers, 2 Large Bags, 1 Small Bag Estate => up to 4 Passengers, 4 Large Bags or 3 Large bags and 2 Small Bag or 2 Large Bags and 4 Small bags or some other combunations MPV => Up to 6 Passengers, 3 Large Bags and 2 Small Bags or other combinations Minibus => Up to 8 Passengers and 10 Large Bags and 5 Small bags or other combinations of large and small bags Form Entry: 3 Passengers + 3 Large Bags + 2 Small Bags This should only Return ESTATE. I hope I could explain enough.
  4. // First, we need to take their postcode and get the lat/lng pair: $postcode = $_REQUEST['postcode']; // Sanitize their postcode: $search_code = urlencode($postcode); $url = 'http://maps.googleapis.com/maps/api/geocode/json?address=' . $search_code . '&sensor=false'; $json = json_decode(file_get_contents($url)); $lat = $json->results[0]->geometry->location->lat; $lng = $json->results[0]->geometry->location->lng; // Now build the lookup: $address_url = 'http://maps.googleapis.com/maps/api/geocode/json?latlng=' . $lat . ',' . $lng . '&sensor=false'; $address_json = json_decode(file_get_contents($address_url)); $address_data = $address_json->results[0]->address_components; $street = str_replace('Dr', 'Drive', $address_data[1]->long_name); $town = $address_data[2]->long_name; $county = $address_data[3]->long_name; $city = $address_data[4]->long_name; $country = $address_data[5]->long_name; $array = array('street' => $street, 'town' => $town, 'city' => $city, 'country' => $country); //echo json_encode($array); echo $array = implode(", ",$array);
  5. // First, we need to take their postcode and get the lat/lng pair: $postcode = $_REQUEST['postcode']; // Sanitize their postcode: $search_code = urlencode($postcode); $url = 'http://maps.googleapis.com/maps/api/geocode/json?address=' . $search_code . '&sensor=false'; $json = json_decode(file_get_contents($url)); $lat = $json->results[0]->geometry->location->lat; $lng = $json->results[0]->geometry->location->lng; // Now build the lookup: $address_url = 'http://maps.googleapis.com/maps/api/geocode/json?latlng=' . $lat . ',' . $lng . '&sensor=false'; $address_json = json_decode(file_get_contents($address_url)); $address_data = $address_json->results[0]->address_components; $street = str_replace('Dr', 'Drive', $address_data[1]->long_name); $town = $address_data[2]->long_name; $county = $address_data[3]->long_name; $city = $address_data[4]->long_name; $country = $address_data[5]->long_name; $array = array('street' => $street, 'town' => $town, 'city' => $city, 'country' => $country); //echo json_encode($array); echo $array = implode(", ",$array);
  6. So can I do this with mysql too. Can the following code output the same result? ($pickup is populated from database) $pickup= array ($pickup); natsort($pickup); echo '<pre>',print_r($pickup, true),'</pre>';
  7. Hello, I have the following code to get data from mysql. SELECT COUNT(*),pickup FROM journeys WHERE pickup_type='postcode' GROUP BY pickup HAVING COUNT(*)>=1 The result is like this; E1 E10 E11 E12 E13 E2 E3 E4 ....... I need to display the data starting from E1 ...... to ....E13 (or whatever the last entry is). Could anyone help? Regards
  8. Update: I managed to changed the payment status to "Completed" but I still dont get the email confirming that. see code below if ($payment_status == "Completed"){ mail('testemail@gmail.com', 'IPN Progress', 'Section 4 Completed'); }
  9. Quick Update, I found out that the payment status is "Pending". I am not sure why but this is why the section 4 is not completed. So could anyone tell me how to change the status to "Completed"
  10. Ok, I have the follwing code. I inserted mail() functions to check the process of the codes. Emails come up to Section 3 Completed and stops. So there is a little problem with section 4. I think payment status is not Completed but I am not sure how to check that. Could anyone give me his opinion how to go from here? <?php ini_set('log_errors', true); ini_set('error_log', 'ipn_errors.log'); //connect to database //$error = "Problem connecting"; //mysql_connect('localhost','_prince','getmeout') or die($error); //mysql_select_db('hmt_cms') or die($error); mail('email@gmail.com', 'IPN Progress', 'Section 1 Completed'); // read the post from PayPal system and add 'cmd' $req = 'cmd=_notify-validate'; foreach ($_POST as $key => $value) { $value = urlencode(stripslashes($value)); $req .= "&$key=$value"; } mail('email@gmail.com', 'IPN Progress', 'Section 2 Completed'); // post back to PayPal system to validate $header .= "POST /cgi-bin/webscr HTTP/1.0\r\n"; $header .= "Content-Type: application/x-www-form-urlencoded\r\n"; $header .= "Content-Length: " . strlen($req) . "\r\n\r\n"; $fp = fsockopen ('ssl://www.sandbox.paypal.com', 443, $errno, $errstr, 30); mail('email@gmail.com', 'IPN Progress', 'Section 3 Completed'); // assign posted variables to local variables $item_name = $_POST['item_name']; $item_number = $_POST['item_number']; $payment_status = $_POST['payment_status']; $payment_amount = $_POST['mc_gross']; $payment_currency = $_POST['mc_currency']; $txn_id = $_POST['txn_id']; $receiver_email = $_POST['receiver_email']; $payer_email = $_POST['payer_email']; if (!$fp) { mail('email@gmail.com', 'IPN Progress', 'IPN Error 1'); } else { fputs ($fp, $header . $req); while (!feof($fp)) { $res = fgets ($fp, 1024); if (strcmp ($res, "VERIFIED") == 0) { if ($payment_status == "Completed") { mail('email@gmail.com', 'IPN Progress', 'Section 4 Completed'); if ($payment_amount==0.01 && $payment_currency=="GBP") { mail('email@gmail.com', 'IPN Progress', 'Section 5 Completed'); //$update = mysql_query("UPDATE cms SET premium='1' WHERE email='$payer_email'"); } } // check the payment_status is Completed // check that txn_id has not been previously processed // check that receiver_email is your Primary PayPal email // check that payment_amount/payment_currency are correct // process payment } else if (strcmp ($res, "INVALID") == 0) { // log for manual investigation mail('email@gmail.com', 'IPN Progress', 'IPN Error 2'); } } fclose ($fp); } ?>
  11. Thanks for the reply, I already have and i couldnt find the information I needed.
  12. Hello everyone, I have been searching on internet about using paypal payment for a minicab booking form I havebut I couldnt find anything that I could use. What I have; The visitor comes to website and start completing the form. They get a price on the second page and the third page is the process page. The data goes to database and customer gets an email and the website admin gets the booking form in email. What I want to do; I want to enable paypal payment so visitor can pay for the minicab journey online. I need the get this working in a way that visitor gets the second page and sees the price, clicks Book & Pay by paypal button and visitor is redirected to paypal for payment, after payment, all the data enters the database (The variables are about 10-15) and customer gets the email and also lands on the success page. If the payment is not successfull then nothing goes to data base and visitor does not get email and visitor then is redirected to cancellation page. I hope I could explained, Could anyone help me how to do it or where I can find the information I needed. Regards
  13. Hello, That is what i need to find out. How to do it with Ajax.
  14. Quick update: I have managed to solve the first part where multiple same value to display one by the following code; $sql = "SELECT COUNT(*),pickup FROM journeys GROUP BY pickup HAVING COUNT(*)>=1"; $retval = mysql_query( $sql ); if(!$retval){die('Could not get data: ');} Now i need to load the second SELECT BOX with data from where pickup is first SELECT BOX as mention above by Freak Dr. Any idea anyone?
  15. Please see the screenshot of the tabel. As you see there are 5 pick up address and all HA1 Harrow to same destination but with different vehicle with different price. If I pull pick up from data base, it will display all 5 HA1 Harrows in the drop down list. I am trying to get only one of the multuiple same values and then display one of the 5 destination values and then price will show according the vehicle selection. Hope this makes more sense..
  16. Hello everyone, I am trying to create a minicab booking form with mysql I have created following tables category (this where the locations categorised like Airport, Postcode, Stattions etc) Locations (this is where the pick up address and destination address will be choosed from) Journeys (This is where the journey pick up, destination, vehicle and the price will be stored.) What I am trying to achieve is, after storing all the information into tables, visitors will be schoosing a pick up address and destination so they can get a price. At the moment addresses are loaded from LOCATIONS table into both fields. See picture below: The problem with it is, the locations are shown regardles if there is a journey with price with it or not. What I want is to fetch only the data from JOURNEYS with price. Could anyone help me with this?
  17. Thank you mac_gyver. it is a great explanation.I will work on it as soon as i can
  18. Hello everyone. As it states above, I am planning the load all the data to the database and get the calculation done. Could anyone tell me the logic of doing this and give an example if possible. Thanks
  19. I have realised that the user names are lowercase, it worked After changing the ADMIN to admin. Thanks a lot
  20. Ok. what I have is a table called users and in that table there are the following; username password userid userlevel email timestamp Admin doesn not have a value
  21. Thanks for quick replies. Could you possible wrote the code where it excludes the ADMIN?
  22. Dear users, I am trying to disregard ADMIN when displaying registered users from USERS table. The code I am using is if($session->isAdmin()) {$query="SELECT username FROM users ";} This gives me all the users from the database. What I want to do is not to display ADMIn and display the rest of the users. is it possible? Could anyone help?
  23. Thanks for the quick reply Jessica, I will look for that. I will try to include the codes here... This is the index.php (First part of the form where user selects the type of the journey) <form action="indexa.php" method="post" name="form1" > <table width="99%" border="0" cellspacing="0" cellpadding="0"> <tr> <td height="30" align="center" valign="middle"><font size = "4">Journey Type: </font></td> </tr> <tr> <td height="30" align="center" valign="middle"> <select name="journey" class="dropdown" id="journey"> <option value="Select Journey" selected>Select Your Journey</option> <option value="Town to Airport"> Post Code to Airport </option> <option value="Town to Station"> Post Code to Station </option> <option value="Town to City"> Post Code to City </option> <option value="Airport to Town"> Airport to Post Code </option> <option value="Airport to Airport">Airport to Airport</option> <option value="Airport to City"> Airport to City </option> <option value="Station to Town"> Station to Post Code </option> </select></td> </tr> <tr> <td height="10" align="center" valign="middle"> </td> </tr> <tr> <td height="20" align="center" valign="middle"><input type="hidden" name="posted" value="true" /></td> </tr> <tr> <td height="20" align="center" valign="middle"> <input name="Submit2" type="submit" class="form-button" value="Continue" /> </td> </tr> </table> </form> This is indexa.php where other form is generated according to the selection on index.php <?php error_reporting( E_ALL ); if(isset($_POST["posted"])) $journey = $_POST["journey"]; switch($journey) { case "Airport to Town": include("journey-types/a2t.php"); break; case "Town to Airport": include("journey-types/t2a.php"); break; case "Airport to Airport": include("journey-types/a2a.php"); break; case "Station to Town": include("journey-types/s2t.php"); break; case "Town to Station": include("journey-types/t2s.php"); break; case "Airport to City": include("journey-types/a2c.php"); break; case "Airport to Station": include("journey-types/a2s.php"); break; case "Town to City": include("journey-types/t2c.php"); break; default: include("journey-types/error.php"); break; } ?> This is the index2.php where the journey price is calculated according to prices.php <?php if ($journey == "Airport to Town" ){ $price = (($quotation * $executive)+ $airportpickup); echo "Executive"; echo "&nbsp"; echo "£"; echo number_format($price, 2, '.', ''); } else {($price = $quotation * $executive); echo "Executive"; echo "&nbsp"; echo "£"; echo number_format($price, 2, '.', ''); } ?>" This is prices.php where the price is calculated according to selection on indexa.php <?php //Airports// if ($postcode == "AL1 St. Albans" && $airport == "Heathrow T1" ) { $quotation = 42;} if ($postcode == "AL1 St. Albans" && $airport == "Heathrow T2" ) { $quotation = 42;} if ($postcode == "AL1 St. Albans" && $airport == "Heathrow T3" ) { $quotation = 42;} if ($postcode == "AL1 St. Albans" && $airport == "Heathrow T4") { $quotation = 42;} if ($postcode == "AL1 St. Albans" && $airport == "Heathrow T5") { $quotation = 42;} if ($postcode == "AL1 St. Albans" && $airport == "Gatwick North Terminal" ) { $quotation = 77;} if ($postcode == "AL1 St. Albans" && $airport == "Gatwick South Terminal" ) { $quotation = 77;} if ($postcode == "AL1 St. Albans" && $airport == "Luton" ) { $quotation = 32;} if ($postcode == "AL1 St. Albans" && $airport == "Stansted" ) { $quotation = 60;} if ($postcode == "AL1 St. Albans" && $airport == "City" ) { $quotation = 60;} //Stations// if ($postcode == "AL1 St. Albans" && $airport == "Victoria Station") { $quotation = 57;} if ($postcode == "AL1 St. Albans" && $airport == "St Pancras Station") { $quotation = 55;} if ($postcode == "AL1 St. Albans" && $airport == "Kings Cross Station" ) { $quotation = 55;} if ($postcode == "AL1 St. Albans" && $airport == "Waterloo Station" ) { $quotation = 57;} if ($postcode == "AL1 St. Albans" && $airport == "Euston Station" ) { $quotation = 55;} if ($postcode == "AL1 St. Albans" && $airport == "Liverpool St. Station" ) { $quotation = 55;} //Towns// if ($postcode == "AL1 St. Albans" && $airport == "Dover") { $quotation = 150;} if ($postcode == "AL1 St. Albans" && $airport == "Southampton") { $quotation = 135;} if ($postcode == "AL1 St. Albans" && $airport == "Harwich" ) { $quotation = 120;} if ($postcode == "AL1 St. Albans" && $airport == "Portsmouth" ) { $quotation = 135;} if ($postcode == "AL1 St. Albans" && $airport == "Birmingham" ) { $quotation = 140;} if ($postcode == "AL1 St. Albans" && $airport == "Manchester" ) { $quotation = 215;} if ($postcode == "AL1 St. Albans" && $airport == "Glasgow" ) { $quotation = 425;} if ($postcode == "AL1 St. Albans" && $airport == "Cambridge" ) { $quotation = 78;} if ($postcode == "AL1 St. Albans" && $airport == "Brighton" ) { $quotation = 130;} if ($postcode == "AL1 St. Albans" && $airport == "Oxford" ) { $quotation = 89;} ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ?> I hope this information is usefull...
×
×
  • 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.