Jump to content
Larry Ullman's Book Forums


  • Content Count

  • Joined

  • Last visited

  • Days Won


Paul last won the day on April 17 2013

Paul had the most liked content!

Community Reputation

6 Neutral

About Paul

  • Rank
    Advanced Member
  1. Thanks HartleySan for the suggestion. I'm away at the weekend so other things need doing. I'll try it when I can and get back to you. Thanks again. Paul
  2. Hi HartleySan, Thanks for the answer. 1. The $curtain_price_total was initialised, it was at the top of the page and I didn't include it. $curtain_price_total = 0; 2. I changed the code to $curtain_price_total += (int)$cur_v; It didn't work unfortunately. I did think about adding the '(int)' within the foreach but some of the values are strings. Thanks anyway. Paul
  3. Hi rob, Thanks for the answer. I tried removing the 'float' part of the number_format code and it made no difference. I take your point though, I can see why it wouldn't be needed. I'll bear that in mind and change it where I've used it in other areas. However, if it were a formatting issue then would that make the 'curtain_price_total' variable incorrect? Cheers Paul
  4. Hi all, I'm querying a DB for basket contents. I'm then using a foreach to display and then add the totals togethor. The grand total is then being displayed below the list of items in the basket. All pretty standard stuff. However if the amount of one of the items in the basket is greater that 999 it just counts the number of thousands, i.e. £1,245.60 will be counted as 1. £2,842.70 is counted as 2. £22,168.50 is counted as 22. Relevant code foreach ($_SESSION['curtain_basket'] as $curtain_title => $curtain_value) { echo'<tr>'; foreach ($curtain_value as $cur_t => $cur_v
  5. No problem Larry. However, if you don't use localhost to test your email coding what do you use? My 'plan B' was to upload the code to a stand-alone page on my own live site and test it there. Obviously a bit more of a phaff because there's more chance of me winning a Nobel prize for PHP coding than my code working first time which means going backwards and forwards with FTPs. Cheers Paul
  6. Hi all, I've written the following very simple piece of code. <?php echo' <h1>Your emails</h1> '; $to = 'demoPHP@localhost.com'; $subject = 'Email testing'; $message = 'test'; mail($to, $subject, $message); ?> The email doesn't arrive in Thunderbird using Mercury Mail in XAMPP on Windows. The text 'Your emails' appears in the browser so I know the file is being processed by PHP. I can send an email using Thunderbird from 'demoPHP@localhost.com' to 'demoPHP@localhost.com' and it arrives in the inbox OK, so I know that Mercury is configured OK in that it's sending
  7. Hi again, Ignore this post, I've worked it out. I was looking for redirects but what I've just noticed is that I've left some form action code on one of the include files that should have been deleted. Delete it and it works OK. Learnt something today. My apologies for bothering everyone. Cheers Paul
  8. Hi everyone, Hope you're all well. Have a look at the following seemingly very straightforward code from a file called 'orders/customer_details.php'. <form action="customer_details.php" method="post" /> <input type="hidden" value="TRUE" name="submitted" /> <input type="submit" value="Place your order" /> </form> Unless I've been misunderstanding for years when I click on 'Place your order' the page should direct to 'customer_details.php' (itself) where there will eventually be other form fields, validation etc. However it redirects to 'orders/basket.php'. I hav
  9. Thanks for the advice. I'll give that a go tomorrow. One thing I find frustrating as a part-timer at this is how often I spend hours, if not days on a script and get 3/4 way through it and find it won't work because I've got the logic wrong. Do you do an outline like you have above before you start a script or or from experience can you just go from top to bottom? Paul
  10. Hiya, The hidden field is there. My confusion is that if there was a problem with the DB query then $row would not contain 25.00. If there was a problem with the form element then the $_POST array would not contain H_H_allowance. One just doesn't seem to pick up the other. I've even just checked my spelling of allowance....make sure I didn't put allowence anywhere. Spelling is not my strong point, nor is PHP it appears! One of those days today. Cheers Paul
  11. Hiya, Really! I've tried that before and got myself in a right mess. If you had form 1 then if {isset($_POST['submitted'] etc. would apply to form 1. Then presumably you would validate that, assign it to variables and then load form 2 based on the answers in form 1. However how would you ensure that form 1 never reloaded? Would you need to nest forms within an if / else? I've always used the same approach. Code at the top with an {isset($_POST['submitted'] and the single form below. I must be getting old because it's never ossurred to me that more than one form can be on the same
  12. Hi all, As the topic title suggests I'm trying to populate a hidden form element with a number retrieved from a DB query. The hidden field appears in the post array but with no value. Yet the value appears in the debugging info. This is the query (it only returns one row): $q = "SELECT H_H_allowance FROM curtain_constants"; $r = mysqli_query ($dbc, $q) or trigger_error("Query: $q\n<br />MySQL Error: " . mysqli_error($dbc)); if (mysqli_num_rows($r) == 0) { //If there's nothing in the DB display this message echo '<p>Oops, something\'s gone wrong. We\'re working on it, please
  13. Hiya HartleySan, Thanks for the response. I'll use sessions I think. The reason I'm using multiple pages is that some fields are only going to be displayed depending on the answers to previous questions. Yes, this can be done in JS but I'm creating a non-JS version first. Cheers Paul
  • Create New...