Jump to content

ianhaney

Members
  • Posts

    330
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by ianhaney

  1. Hi On one of my customers websites, I have a feedback form that automatically adds the feedback to the testimonials page by adding it to the testimonials database table and displays it on the testimonials page I have noticed that if a special character like a ' or something, the feedback is not added I can't remember how to do it so that the feedback is added if it has a special character in the text Can someone help please Kind regards Ian
  2. Hi I have a html contact form in my website and it's action is using a php file and I am trying to get the contact form to send a email to two different email addresses but can't get it working correctly The php file coding the contact form is using is below <?php // EDIT THE 2 LINES BELOW AS REQUIRED $send_email_to = "sales@bhwebsites.co.uk"; $ccemail = "sales@irhwebsites.co.uk"; $email_subject = "Enquiry from the website"; function send_email($name,$email,$email_message) { global $send_email_to; global $ccemail; global $email_subject; $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n"; $headers .= "From: ".$email. "\r\n"; $headers .= "Cc: ".$ccemail. "\r\n"; $message = "<strong>Email = </strong>".$email."<br>"; $message .= "<strong>Name = </strong>".$name."<br>"; $message .= "<strong>Message = </strong>".$email_message."<br>"; @mail($send_email_to, $ccemail, $email_subject, $message,$headers); return true; } function validate($name,$email,$message) { $return_array = array(); $return_array['success'] = '1'; $return_array['name_msg'] = ''; $return_array['email_msg'] = ''; $return_array['message_msg'] = ''; if($email == '') { $return_array['success'] = '0'; $return_array['email_msg'] = 'email is required'; } else { $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/'; if(!preg_match($email_exp,$email)) { $return_array['success'] = '0'; $return_array['email_msg'] = 'enter valid email.'; } } if($name == '') { $return_array['success'] = '0'; $return_array['name_msg'] = 'name is required'; } else { $string_exp = "/^[A-Za-z .'-]+$/"; if (!preg_match($string_exp, $name)) { $return_array['success'] = '0'; $return_array['name_msg'] = 'enter valid name.'; } } if($message == '') { $return_array['success'] = '0'; $return_array['message_msg'] = 'message is required'; } else { if (strlen($message) < 2) { $return_array['success'] = '0'; $return_array['message_msg'] = 'enter valid message.'; } } return $return_array; } $name = $_POST['name']; $email = $_POST['email']; $message = $_POST['message']; $return_array = validate($name,$email,$message); if($return_array['success'] == '1') { send_email($name,$email,$message); } header('Content-type: text/json'); echo json_encode($return_array); die(); ?> Any help would be great Kind regards Ian
  3. Solved it I can paste the coding if need be
  4. 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
  5. 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
  6. 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 }
  7. 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
  8. 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
  9. 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."); }
  10. 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
  11. 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
  12. 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
  13. sent you a couple of pm's White Lily
  14. need bit of help, I will pm you now
  15. Thank you so much really appreciate it
  16. Oh right ok cool
  17. 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
  18. 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
  19. My customer does want a pop up
  20. 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
  21. 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
  22. Hi you ok White Lily How are things going, just sent you a private message Ian
  23. Thank you so much for your time and effort, really appreciate it Sorry to be a pain Ian
  24. 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
  25. 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
×
×
  • 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.