Jump to content

ianhaney

Members
  • Posts

    330
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by ianhaney

  1. Solved it I can paste the coding if need be
  2. I have had a go and did manage to get the order total to divide by two by adding / 2 on the end of the following order_total += item_quantity * item_price So took that out and then inserted the new input field and called it DEPOSIT in the name part and also added the following in // Display the total rounded to two decimal places frm.DEPOSIT.value = round_decimals(order_total, 2) } Then tried to do the following if (item_quantity >= 0) { order_total += item_quantity * item_price; else { order_total += item_quantity * item_price / 2; } but that didn't work as that just made both input fields do nothing so took it out again and at the mo it displays the order total in both input fields see the following link http://www.irhwebsites.co.uk/quote.html
  3. Nothing yet to be honest as was trying to work out where to put a / etc in the javascript but could not work it out
  4. Hi I have the following coding in my website that add's or remove's prices to a quote page and works perfect but I need to insert another input field that takes the order total and divides it by 2 Just wondering how I do that in this coding Below is the HTML <form name="checkbox"> One Page<input type="checkbox" name="PROD_CH_70.00" value="70" onchange="CalculateTotal(this.form)"> <br> Two Pages<input type="checkbox" name="PROD_CH_140.00" value="140" onchange="CalculateTotal(this.form)"> <br> Three Pages(Bronze Package)<input type="checkbox" name="PROD_CH_179.00" value="179" onchange="CalculateTotal(this.form)"> <br> Six Pages(Silver Package)<input type="checkbox" name="PROD_CH_339.00" value="339" onchange="CalculateTotal(this.form)"> <br> Ten Pages(Gold Package)<input type="checkbox" name="PROD_CH_549.00" value="549" onchange="CalculateTotal(this.form)"> <br> New Business Start up<input type="checkbox" name="PROD_CH_289.00" value="289" onchange="CalculateTotal(this.form)"> <br> Ecommerce Package<input type="checkbox" name="PROD_CH_449.00" value="449" onchange="CalculateTotal(this.form)"> <br> SEO on all pages<input type="checkbox" name="PROD_CH_30.00" value="449" onchange="CalculateTotal(this.form)"> <br> Logo Design<input type="checkbox" name="PROD_CH_25.00" value="25" onchange="CalculateTotal(this.form)"> <!--<input type="text" name="PROD_DC_15" size="10" maxlength="3" onchange="CalculateTotal(this.form)"> <input type="text" name="PROD_CC_20" size="10" maxlength="3" onchange="CalculateTotal(this.form)">--> <br><br> <span style="color: #FFFFFF;">£<input type="text" name="TOTAL" size="10" onfocus="this.form.elements[0].focus() "> </span> </form> Below is the javascript coding function CalculateTotal(frm) { var order_total = 0 // Run through all the form fields for (var i=0; i < frm.elements.length; ++i) { // Get the current field form_field = frm.elements[i] // Get the field's name form_name = form_field.name // Is it a "product" field? if (form_name.substring(0,4) == "PROD") { // If so, extract the price from the name item_price = parseFloat(form_name.substring(form_name.lastIndexOf("_") + 1)) // Get the quantity if(form_field.type == 'checkbox') { item_quantity = form_field.checked; } else { item_quantity = parseInt(form_field.value); } // Update the order total if (item_quantity >= 0) { order_total += item_quantity * item_price } } } // Display the total rounded to two decimal places frm.TOTAL.value = round_decimals(order_total, 2) } function round_decimals(original_number, decimals) { var result1 = original_number * Math.pow(10, decimals) var result2 = Math.round(result1) var result3 = result2 / Math.pow(10, decimals) return pad_with_zeros(result3, decimals) } function pad_with_zeros(rounded_value, decimal_places) { // Convert the number to a string var value_string = rounded_value.toString() // Locate the decimal point var decimal_location = value_string.indexOf(".") // Is there a decimal point? if (decimal_location == -1) { // If no, then all decimal places will be padded with 0s decimal_part_length = 0 // If decimal_places is greater than zero, tack on a decimal point value_string += decimal_places > 0 ? "." : "" } else { // If yes, then only the extra decimal places will be padded with 0s decimal_part_length = value_string.length - decimal_location - 1 } // Calculate the number of decimal places that need to be padded with 0s var pad_total = decimal_places - decimal_part_length if (pad_total > 0) { // Pad the string with 0s for (var counter = 1; counter <= pad_total; counter++) value_string += "0" } return value_string }
  5. I might see if there is a better login and registration system then with salting and hashing properly with a forget password feature as well
  6. I thought it was all secured by hash and salt etc as when I look in the database, they passwords are all mixed up with letters and numbers
  7. Hi white lily you ok Yeah sure it is below <div id="forgotpw"> Forgot Password - use form below to reset the password <br> <form name="forgot" method="post" action="<?php $_SERVER['PHP_SELF'];?>"> <p><label for="email">Email:</label> <input name="email" type="text" value="<?=$email; ?>" size="25"/> </p> <input type="submit" name="submit" value="submit"/> <input type="reset" name="reset" value="reset"/> </form> </div> AND THIS AS WELL I THINK $row=mysql_fetch_array($query); $password=$row["password"]; $email=$row["email"]; $subject="your password"; $header="from:noreply@cptevents4.co.uk"; $content="your password is $password"; mail($email, $subject, $row, $header); print "An email containing the password has been sent to you"; } else { echo("no such login in the system. please try again."); }
  8. In my login.php file I got a forgot password text field as well so the user can put their email address in and have a email sent containing their password But am getting the following error and have no idea why Login Failed. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' WHERE 'username' ='.'' at line 1 Any ideas Thank you in advance Ian
  9. Hi, I changed the coding for submit button to <input type="submit" name="login" value="Sign In" id="login" onclick="validLogin()" /> It work's but I have to leave the form coding part in and also when logged in, it is coming up with the pop up box for some reason, I sent you a private message with the form coding Ian
  10. Hi White Lily The login button only works when I put in the form coding part again but if I comment it out, the login button don't work Any ideas
  11. sent you a couple of pm's White Lily
  12. need bit of help, I will pm you now
  13. Thank you so much really appreciate it
  14. Or can I just put the pop up coding in the login.php page and make it so that it knows that the user has logged in
  15. Yeah just need it to be for login and not sign up and then the pop up says you have logged in rather than go to login but am guessing it is easy to change
  16. My customer does want a pop up
  17. Im bit confused as to what to do really as someone said pop up's are bit ruubish and are off putting and some saying it's good what do you guys think
  18. Hi I have a sign up form and want the sign up form to send a email to the user who has just signed up I have the following in my sign up form page <?php $to = "$emailadd"; $subject = "Registration Information"; $emailadd = $_REQUEST['emailadd']; $password = $_REQUEST['password']; $message = $_REQUEST['message']; $headers = "Email Address: $emailadd Password: $password"; $sent = mail($to, $subject, $message, $headers); if($sent) {print "Your mail was sent successfully"; } else {print "We encountered an error sending your mail"; } ?> But am getting the following error We encountered an error sending your mail Any ideas where I am going wrong
  19. Hi you ok White Lily How are things going, just sent you a private message Ian
  20. Thank you so much for your time and effort, really appreciate it Sorry to be a pain Ian
  21. Ahh sorry got ya No sorry I got a login.php page already and just after a user logs in, I need a pop up box similar to what you did but saying login succesful The login.php page is at the following link www.cptevents4.co.uk/login.php
  22. Hi I signed in and came up with go to profile so did that and got the following error Not Found The requested URL /profile.php was not found on this server. Apache/2 Server at www.janedealsart.co.uk Port 80
  23. Yeah that would be great if you give a example to get me started and will try and figure it out
  24. Hi White_Lily Thank you for your reply A jquery pop up box would be better but just not sure how to do it to be honest as the pop up box will need to know that the user has logged in I am not sure how to do that part Ian
×
×
  • 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.