Jump to content

Kristoff1875

Members
  • Posts

    242
  • Joined

  • Last visited

Everything posted by Kristoff1875

  1. Here is the code in action and result. http://www.godesigns.co.uk/Samples/JACK/formtest.html
  2. In as much as its displaying the correct result on an XML page rather than an error, but the result is on a remote site.
  3. The XML page is basically the page that loads after the form is submitted, and it's remote, so I have no way to do anything with the results or direct the user anywhere?
  4. Sounds a bit long winded in the name so i'll explain... I'm coding a site where the user inputs their vehicle reg, and submits the form. The site will then show their car's details. This is being done using an external service that provides an up to date database of vehicle details. So far, i've got the form and when you submit it, it returns the vehicle data in an XML, but the XML it displays is remote. I need to retrieve the details back to the website to display on the page. Here is what I have already: <html> <head> <title>Reg Test Page</title> </head> <body> <form method="post" action="https://www.****.com/UAT/"> <input type="hidden" name="ESERIES_FORM_ID" value="B2INT"> <input type="hidden" name="MXIN_USERNAME" value="****"><br /> <input type="hidden" name="MXIN_PASSWORD" value="****"><br/> REG<input type="text" name="MXIN_VRM" value="REG NUM"><br /> <input type="hidden" name="MXIN_TRANSACTIONTYPE" value="03"><br /> <input type="hidden" name="MXIN_PAYMENTCOLLECTIONTYPE" value="02"><br /> <input type="hidden" name="MXIN_CAPCODE" value="1"><br /> <input type="submit" /> </form> </body> </html> I've ***'d out some details for obvious reason. The form currently works fine and returns a valid XML response, but it's remote. My original plan was to get the form to load up in another php file that processes the detail and sends a file_get_contents() request, but looking at the results page on the xml, there is no extension to the posted url and if you go directly to it, you get the error "METHOD NOT ALLOWED. ONLY 'POST' IS ALLOWED." The other issue I have is that i'm not sure how it's handling the request, and the url is not modified, so i'm not sure how i'd set an url with values to retrieve it? Any help is gratefully received. Cheers Guys.
  5. Thanks for that litebearer. Not quite sure what to do now. It clearly should be working, but for some reason somewhere in the theme it's being messed up. Could it be anything to do with: if (!empty($_POST['price'])) $_POST['price'] = clean_price($_POST['price']); ?
  6. @litebearer: Thanks, not sure why it's not working on the site if you've got it to work? When it's called to the site, this is the code: <p class="bigprice"><?php get_price($post->ID); ?></p> In the theme functions.php file that the clean_price function is in, there is this: // get the ad price and position the currency symbol function get_price($postid) { if(get_post_meta($postid, 'price', true)) { $price_out = get_post_meta($postid, 'price', true); // uncomment the line below to change price format //$price_out = number_format($price_out, 2, '.', ','); $price_out = pos_currency($price_out); } else { $price_out = ' '; } echo $price_out; } // pass in the price and get the position of the currency symbol function pos_price($numout) { $numout = pos_currency($numout); echo $numout; } // figure out the position of the currency symbol and return it with the price function pos_currency($price_out) { if (get_option('curr_symbol_pos') == 'left') $price_out = get_option('curr_symbol') . $price_out; elseif (get_option('curr_symbol_pos') == 'left_space') $price_out = get_option('curr_symbol') . ' ' . $price_out; elseif (get_option('curr_symbol_pos') == 'right') $price_out = $price_out . get_option('curr_symbol'); else $price_out = $price_out . ' ' . get_option('curr_symbol'); return $price_out; } But I can't really make heads nor tales of that, as far as I can see there isn't anything that should affect the removing of the values that shouldn't be there? @Laffin: So should it be? $result = preg_replace("/[^0-9.,&]/","", $string); I basically only want numbers and ,. to be bosted to the page. So if someone posts the value: £100 it removes the £ sign as this gets added on. At the moment you can type "£100GBP" and this shows up as: "££100GBP" as there is a default £ on the page.
  7. Hi Guys, I've got the following on a WP Theme that uses fields for prices: function clean_price($string) { $result = preg_replace("/[^0-9.,]/","", $string); return $result; } Which is then called here: if (!empty($_POST['price'])) $_POST['price'] = clean_price($_POST['price']); But for some reason you can put in £100GBP and that is exactly what is being returned in the page. Anyone got any ideas why? Thanks in advanced
  8. It is kind of related, hence the Username and Password fields, but i'll post again. Thanks again
  9. It's displaying properly so far. Should I make a new topic if I run in to problems regarding the same code? For example logging in and editing etc? Thanks
  10. Just done that I was calling the wrong table, using GiftList instead of GiftListItems. I have the feeling that this is just the start of my quest. I need to make a page to add and edit these lists and also a login page. Oh dear!
  11. Right, don't know if i've done it the right way, but i've now replaced the query, so instead of: $query="select * from GiftList where ID_GiftList='1'"; I'm calling: $query="select * from GiftListItems where ID_GiftList='1'"; This is displaying my list as I want it to, and only from the correct list too. I still think there's something that won't be right!
  12. That's what I mean though, my items I want to display are in the GiftListItems table.
  13. I may be misunderstanding the point completely, however: $query = "SELECT * FROM news WHERE id='$id' ORDER BY id DESC"; $title = $row['title']; $posted_by = $row['postedby']; Aren't those values in the news table?
  14. So create a page for each item? Can't I just get it to call in to: while($nt=mysql_fetch_array($rt)){ echo "$nt[Owner] $nt[Name] $nt[Price] $nt[Availability]<br>"; // name class and mark will be printed with one line break } ? I only want to list the items rather than having a page for each one. At the moment the list is showing up, in that it's showing the correct list number, but it's not showing any of the items on the list.
  15. Don't worry, it's probably me not you! Basically the way I understand it as it was explained to me is the GiftList table will have the ID of the list and the username of who's list it is. Then the GiftListItems table will store all of the items that will be used on each list. So for example if the list with ID 1 (in GiftList table) would have items with the ID 3, 4, 7, 11 (from GiftListItems) in the list. For each item ID there is Name, Price, Availability - these are the details that I want to display.
  16. Ok here goes... Here is my SQL: -- phpMyAdmin SQL Dump -- version 3.4.3.2 -- http://www.phpmyadmin.net -- -- Host: localhost -- Generation Time: Aug 12, 2011 at 11:44 PM -- Server version: 5.0.91 -- PHP Version: 5.2.9 SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; -- -- Database: `gdesignz_Giftlist` -- -- -------------------------------------------------------- -- -- Table structure for table `GiftList` -- CREATE TABLE IF NOT EXISTS `GiftList` ( `ID_GiftList` int(11) NOT NULL auto_increment, `Owner` varchar(100) NOT NULL default '', PRIMARY KEY (`ID_GiftList`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=50002 ; -- -- Dumping data for table `GiftList` -- INSERT INTO `GiftList` (`ID_GiftList`, `Owner`) VALUES (1, 'Admin'); -- -------------------------------------------------------- -- -- Table structure for table `GiftListItems` -- CREATE TABLE IF NOT EXISTS `GiftListItems` ( `ID_GiftListItem` int(11) NOT NULL auto_increment, `ID_GiftList` varchar(100) NOT NULL default '', `Name` text NOT NULL, `Price` decimal(10,2) NOT NULL, `Link` text NOT NULL, `Availability` enum('Available','Reserved') NOT NULL, PRIMARY KEY (`ID_GiftListItem`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ; -- -- Dumping data for table `GiftListItems` -- INSERT INTO `GiftListItems` (`ID_GiftListItem`, `ID_GiftList`, `Name`, `Price`, `Link`, `Availability`) VALUES (1, '1', 'Morphy Richards Red Accents slow cooker', 34.99, 'http://www.houseoffraser.co.uk/Morphy+Richards+Red+Accents+slow+cooker+48728/146808112,default,pd.html', 'Available'); -- -------------------------------------------------------- -- -- Table structure for table `Users` -- CREATE TABLE IF NOT EXISTS `Users` ( `ID_Users` int(11) NOT NULL auto_increment, `Username` varchar(100) NOT NULL default '', `Password` text NOT NULL, PRIMARY KEY (`ID_Users`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ; -- -- Dumping data for table `Users` -- INSERT INTO `Users` (`ID_Users`, `Username`, `Password`) VALUES (1, 'Admin', 'password'); /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; And on the giftlist page: <?php //Include database connection details require_once('list/config.php'); //Array to store validation errors $errmsg_arr = array(); //Validation error flag $errflag = false; //Connect to mysql server $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); if(!$link) { die('Failed to connect to server: ' . mysql_error()); } //Select database $db = mysql_select_db(DB_DATABASE); if(!$db) { die("Unable to select database"); } $query="select * from GiftList where ID_GiftList='1'"; // query string stored in a variable $rt=mysql_query($query); // query executed echo mysql_error(); // if any error is there that will be printed to the screen while($nt=mysql_fetch_array($rt)){ echo "$nt[Owner] $nt[Name] $nt[Price] $nt[Availability]<br>"; // name class and mark will be printed with one line break } ?> I added the $nt[Owner] part to see if anything was showing up. I am currently getting just "Admin" showing up, so it's showing the list, just not the stuff to go on the list, which is where i'm missing how it calls the data from the GiftListItems table to the GiftList table. Cheers
  17. Hi, thanks for the reply buddy. I am able to get the results to output, but what I actually need is to link the fields from the different tables together. I've noticed I missed a field which tells the giftlistitem which list it is from in the giftlist table, I'm just not sure how i'm meant to tell it what to do.
  18. I'm working on something like this at the moment, and this is exactly what I need. Can I just ask, the way it's laid out, does that bring up pre-populated text fields with what's already there and they can change it and save the changes?
  19. Hi, i've progressed from the topic here: http://www.phpfreaks.com/forums/index.php?topic=341230.0 And now have 3 tables set up: -- phpMyAdmin SQL Dump -- version 3.4.3.2 -- http://www.phpmyadmin.net -- -- Host: localhost -- Generation Time: Aug 12, 2011 at 09:01 PM -- Server version: 5.0.91 -- PHP Version: 5.2.9 SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; -- -- Database: `gdesignz_Giftlist` -- -- -------------------------------------------------------- -- -- Table structure for table `GiftList` -- CREATE TABLE IF NOT EXISTS `GiftList` ( `ID_GiftList` int(11) NOT NULL auto_increment, `Owner` int(11) NOT NULL, PRIMARY KEY (`ID_GiftList`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `GiftListItems` -- CREATE TABLE IF NOT EXISTS `GiftListItems` ( `ID_GiftListItem` int(11) NOT NULL auto_increment, `Name` text NOT NULL, `Price` decimal(10,2) NOT NULL, `Link` text NOT NULL, `Availability` enum('Available','Reserved') NOT NULL, PRIMARY KEY (`ID_GiftListItem`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=50002 ; -- -- Dumping data for table `GiftListItems` -- INSERT INTO `GiftListItems` (`ID_GiftListItem`, `Name`, `Price`, `Link`, `Availability`) VALUES (50001, 'Morphy Richards Red Accents slow cooker', 34.99, 'http://www.houseoffraser.co.uk/Morphy+Richards+Red+Accents+slow+cooker+48728/146808112,default,pd.html', 'Available'); -- -------------------------------------------------------- -- -- Table structure for table `Users` -- CREATE TABLE IF NOT EXISTS `Users` ( `ID_Users` int(11) NOT NULL auto_increment, `Username` text NOT NULL, `Password` text NOT NULL, PRIMARY KEY (`ID_Users`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ; -- -- Dumping data for table `Users` -- INSERT INTO `Users` (`ID_Users`, `Username`, `Password`) VALUES (1, 'Admin', 'password'); /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; How do I now go about setting up a list in the GiftList and getting it to display just that list on the page? Thanks in advance.
  20. Ok, didn't know whether to make a new topic or not, sorry.
  21. I'm quite new to this. I've set up the 3 tables, but how do I go about getting a GiftList from in the first table to contain the data from GiftListItems and Users tables? Thanks in advanced
  22. Have created a SQL file exported from my database. Would you be able to check it over? I've sent you a private message. Thanks
×
×
  • 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.