Jump to content

denno020

Members
  • Posts

    761
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by denno020

  1. I'm pretty sure you can just make your user validation an else if of your security number validation. That will ensure only one of each will run, IF they're incorrect. If they're both correct, then your else to user validation will run as per usual. if($sec_no == ''){ //$er1 = "<font color=red><b>Security Number Missing</b></font><br>"; echo "<font color=red><b>Security Number Missing</b></font><br>"; }else if($uname == ''){ //$er2 = "<font color='red'><b>Username Missing</b></font>"; echo "<font color='red'><b>Username Missing</b></font>"; }else{ // check for valid user //etc.... That's all you need, just add that else before your user validation 'if', and the user validation will only be checked if the security code validates and passes.
  2. Hi all, I would like to move files automatically, using a PHP script, from one folder to another. However each file will go to a different folder, so I want to only move one file at a time, and wait for the previous one to finish before I move on to the next one. I have some ideas on how I can do this, but I'm not sure how I could test it without actually implementing it and possibly locking up my system if I have too many file transfers happening at once, so I just wanted to bounce them off the knowledgeable people here. The PHP function copy will be able to do the copy for me, and it will return a true/false upon success/failure of the transfer. So I was thinking I could initiate a copy, and then have a while loop that continually loops while the function is false. When it becomes true, it will break the while loop and continue on to the next file. My only concern with this is if the file transfer does actually fail for some reason, then I wouldn't really know.. Is there any other way that would be better? I'm going to be using the script to move tv shows from one folder (where they're all mixed up), to its folder on my external hard drive (I can manage figuring out the logic for which folder a file should go to, that's not a problem). Some of the shows can be up to and over 1GB in size too, so I'm not sure if that's something that I would need to take into consideration? Hopefully I've made my problem clear and understandable. Thanks, Denno
  3. There's a bit more that you need to do: function calcVals(){ //set form to document.form1 form = document.form1; //get the fields val = document.getElementsByName('AdditionalMarks')[0].value; val1 = document.getElementsByName('NumberOfCourses')[0].value; //check the value and set the price if (val<=4) { var markprice=5; }else if (val>=5 && val<= { var markprice=10; }else if (val >= 9) { var markprice=15; } //multilpy all the fields up total = (val * markprice) * val1; //if there's a problem inform the user if (String(total) != 'NaN') { form.valTotal.value = total; alert(total); //show pop up dialog with the total cost (used for debugging) }else{ form.valTotal.value = 'ERROR'; } } That code seems to work, as you can see from the alert I've made pop up, however the value that's set in the total cost field doesn't stay there, it is always changed back to 0 after a split second.. I'm not sure why that is, but maybe you could figure it out as you play with it.
  4. I think you need to put '.value' at the end of the assignments to variables val and val1.
  5. I'm pretty sure that if there is nothing vertical that can be scrolled, then moving the mouse wheel will scroll horizontally instead (if there is horizontal scrolling required). So maybe try disabling anything that may require vertical scrolling, and then see if that helps..
  6. Thanks White_Lily, appreciate the extra info . I'm pretty familiar with using the different positioning options, I just wasn't aware that it was directly related to z-index. As for the constant posting, that's fine.. If you refreshed the page however, you would see that I marked it as solve about 30 minutes ago Thanks again Denno
  7. I've done something really quick here, which demonstrates what I mean. You'll have to play with the margin's and paddings to get it lined up as it was before, but that shouldn't be too much of a problem. http://jsfiddle.net/denno020/P2Uga/
  8. Why don't you put both the button and the content that is hidden inside a single div, and give it a left border of 3px and the colour purple. Then when the name is pressed, the new content will be shown, which will stretch the parent div that they're both in, which in turn would stretch the purple line down. Sorry if you're already fixed the issue, I've only just looked at the date.. Denno
  9. You're a champion mate, that is exactly what I needed . I've used z-index's successfully before, however that was when I was using positioning extensively for the layout, so I didn't realize that it was related to the z-index working. Thanks heaps . Denno
  10. It's late at the moment, so I could be missing something really simple, but I can't, for the life of me, get my sub nav div to be layered on top of my content div. I want it to be over so that when I click on a link, I can change the border of the sub navigation link to white, to make it appear that it's a tab that's opened to that page. I've created a test html file which still has the same problem, but I can atleast share it here and people can run it themselves to see what I'm talking about. I've tried playing with z-index's, but it's possible that I'm using them completely wrong, as I've never really studied them too much. Anyway, the following is the code, and the way I was testing was to see if the red right hand border of the sub navigation links would display above the grey border of the main content. You can copy the code below, or play with it on jsfiddle: http://jsfiddle.net/denno020/WJxD7/ <!DOCTYPE html> <html> <head> <title></title> <style type="text/css"> .wrapper{ position: relative; width: 1022px; margin: 0px auto; } #main_content #content{ line-height: 25px; z-index: -2; } .height{ height: 295px; } .grid_back{ background-color: white; border: 1px solid grey; } .grid1{ width: 128px; margin: 3px; padding: 5px; float: left; overflow-y: auto; } .grid6{ width: 858px; margin: 3px; padding: 5px; float: left; overflow-y: auto; } #sub_nav{ overflow:visible; } #sub_nav ul li{ margin-right: -12px; padding-right: 10px; border: 1px solid red; text-align: right; background-color: white; height: 35px; line-height: 35px; list-style: none; z-index: 1; } #sub_nav ul li.current{ border-right: 1px solid white; } </style> </head> <body> <section id="main_content" class="wrapper"> <div id="sub_nav" class="grid1"> <ul> <li><a href="#">Facilities</a></li> <li><a href="#">Volunteers</a></li> <li><a href="#">Sponsors</a></li> <li><a href="#">Events</a></li> </ul> </div> <div id="content" class="grid6 grid_back"><h1>Club</h1> <p>There's a whole heap of info here</p><p>There's a whole heap of info here</p><p>There's a whole heap of info here</p><p>There's a whole heap of info here</p><p>There's a whole heap of info here</p><p>There's a whole heap of info here</p><p>There's a whole heap of info here</p><p>There's a whole heap of info here</p><p>There's a whole heap of info here</p></div> <div class="clear_float"></div> </section> </body> </html> Hopefully my problem makes sense. Any help, as always, is greatly appreciated. Thanks Denno
  11. Any chance you can post the SQL code so I can build the database on my test server and try to replicate the error?
  12. I've been asked to create a class that does some stuff, and then returns an object with read only properties.. Now I've created the class and I've got everything working 100%, however I'm confused when they say to 'return an object with read only properties'.. This is the outline of my php file which contains the class and some extra lines calling it etc: class original(){ protected $self = array(); function __construct{ //do processing and build the array } function getAttributes(){ return $this->self; //return the protected array (for reading) } } $original = new original(); print_r($original->getAttributes()); Can someone please help me with returning an object or something? Thanks Denno
  13. add_testimonial.php <?php <script> $(function() { $('.error').hide(); $(".button").click(function() { // validate and process form here $('.error').hide(); var name = $("input#name").val(); if (name == "") { $("label#name_error").show(); $("input#name").focus(); return false; } var email = $("input#email").val(); if (email == "") { $("label#email_error").show(); $("input#email").focus(); return false; } var testimonial = $("textarea#testimonial").val(); if (testimonial == "") { $("label#testimonial_error").show(); $("input#testimonial").focus(); return false; } var dataString = 'name='+ name + '&email=' + email + '&testimonial=' + testimonial; //alert (dataString);return false; $.ajax({ type: "POST", url: "scripts/parse_testimonial.php", data: dataString, success: function() { $('#contactForm').html("<div id='message'></div>"); $('#message').html("<h2>Contact Form Submitted!</h2>") .append("<p>We will be in touch soon.</p>") .hide() .fadeIn(1500, function() { $('#message').append(""); }); } }); return false; }); }); </script> <form name="add_testimonial_form" id="add_testimonial_form" action="" method="POST"> <label for="name" class="error" id="name_error">Please Enter A Name</label> <div><input type="text" name="name" id="name" placeholder="Name"/></div> <label for="email" class="error" id="email_error">Please Enter An Email</label> <div><input type="email" name="email" id="email" placeholder="Email" /></div> <label for="testimonial" class="error" id="testimonial_error">Please Enter A Testimonial</label> <div><textarea name="testimonial" id="testimonial" rows="5" placeholder="Testimonial"></textarea></div> <div><input type="submit" name="submit" class="button" id="submit_btn" value="Send" /></div> </form> ?> parse_testimonial.php <?php require_once "scripts/connect_to_mysql.php"; function cleanInput($data){ $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); return $data; } //if(isset($_POST['submit'])){ $statusMessage = ""; $name = ""; $email = ""; $testimonial = ""; //check the form fields for stuff having been entered if ((isset($_POST['name'])) && (strlen(trim($_POST['name'])) > 0)) { $name = cleanInput(strip_tags($_POST['name'])); } else {$name = 'No name entered';} if ((isset($_POST['email'])) && (strlen(trim($_POST['email'])) > 0)) { $email = cleanInput(strip_tags($_POST['email'])); } else {$email = 'No email entered';} if ((isset($_POST['testimonial'])) && (strlen(trim($_POST['testimonial'])) > 0)) { $testimonial = cleanInput(strip_tags($_POST['testimonial'])); } else {$testimonial = 'No testimonial entered';} //Build query string to insert new data. //$sqlCommand = "INSERT INTO testimonials(name, email, date, testimonial) VALUES ('$name', '$email', curdate(), '$testimonial')"; //mysql_query($sqlCommand, $myConnection) or die (mysql_error()); //echo "Thanks"; //Confirm the sending on the form. exit(); //Don't display the form again after one has just been submitted. } //display error message on fields that aren't correctly filled in //if all correctly filled in, then submit the form and thank the user for their input //echo $statusMessage; //} ?> inside index.php, I use a php include to put the contents of add_testimonial.php inside the "contactForm" div. My code works perfectly, however I would like to be able to have a success/fail message passed back from parse_testimonial.php. (I added the opening and closing php tags in the post for add_testimonial.php just so that the code would be highlighted, it's not in my actual code). Thanks, Denno
  14. I am stumped at how to try and figure my problem out.. I've got a form that is checked using jQuery to make sure all fields are entered, and also checked in php after being submitted, again to make sure there was something in the fields. I ran through this tutorial http://net.tutsplus.com/tutorials/javascript-ajax/submit-a-form-without-page-refresh-using-jquery/, so that's basically the code I am using. I would like to be able to display a message to the user if they somehow managed to submit the form, and get past the javascript form validation without anything in a field.. How could I do this? I wasn't really sure how to word my problem, so searching google for help is a bit tricky as I don't really know what I'm searching for.. Thanks, Denno
  15. I've got a page that has a dynamic number of checkboxes. I'm trying to figure out how to process the form once submitted. I've got a foreach loop set up, but I need to know the id of the checkbox so that I can make the change to my database accordingly. At the moment, my form is built with the checkboxes given the name of "checkbox['$id']", where id is pulled from the database. In my parsing script, I've got this foreach loop that I found on the internet foreach($_POST["checkbox"] as $checkbox){ } But I don't know what to put in that foreach loop to be able to grab the id that the checkbox was given when the form was initially built? I'm struggling to find any examples on the Internet :/.. Denno
  16. Well if the boss is calling the shots, then make it as ugly as he asks lol.
  17. Sorry one more thing.. I'm not a fan of the animated gif showing the payment methods that you take.. It's much more common with web design nowadays to not use animated gifs at all. So for your situation, just a simple graphic with the logo's of all payment methods shown in a row, next to each other.. Will appear much more professional. I have read this in a number of web design blogs, and I have to agree with them..
  18. Oh ok.. This is different to the page you linked to in your original post? I'm using Chrome and your header seems to be stuck to the left, whilst everything else is centred.. Not sure if this is the desired effect.. Looks a bit odd. Also, the header on the vehicles page is different. You might want to change that to be the same as the other pages for consistency. As for the vehicle photo's that have been cut out.. if I were you I'd try and apply some sort of fading around the edges, so it's not just a straight cut with the square pixels being visible.. So in Photoshop if you marquee a few pixels outside the actual car, and apply a feather to it.. Might look a bit better than what you have now. Hope that helps mate. Denno
  19. Always happy to help . Could I suggest you have a look at the design of your site though. As I said before, it looks rather messy and confusing. There doesn't really seem to be a theme with it, just lots of colours. If this is for a company, then I feel it doesn't really give a great impression of that company.. This is just my opinion and I know you didn't ask for it, but I just couldn't help myself.. Denno
  20. heading tags have margin and padding added to them by the browser. You need to overwrite this in your stylesheet, effectively 'resetting' the margin and padding. Might also want to try giving your content div a margin-top or 0px.. Denno
  21. As far as I can tell, the scrollbar is exactly what is causing your problem. I have a large monitor, so none of your pages require vertical scrolling for me to see the content, and no page was shifting when loaded. Try making the window really small, so that every single page will require scrolling. Then see if any pages shift when loaded. Also, your contact us page links to your about us page. Might want to fix that up. Denno
  22. I've tried looking at the site to replicate the problem, but the page is just too busy, I have no idea where to start or anything..
  23. as I think the person before me said, if some pages are long enough that require scrolling, then the width for the page to be centred within will be smaller by the width of the slider. I was having this problem with my site too, and took forever to figure out that the slight movement was due to the need for the slider on the right of the page. I can't remember if I fixed mine or not.. I think I just left it.. But hopefully that will get you started to figuring out a solution.. Denno
  24. I think you want something like 'lightbox'. If you search Google for that, you will find examples and hopefully be able to work it out from there. Denno
  25. Well to display errors without reloading the page, then you will need to use javascript. If you need to check with a database to see if there are errors, you will need to use AJAX. Otherwise, if you don't mind the same page being reloaded, then put the form processing at the top of the page with the form, surrounded by an if(isset($_POST['submit'])) statement. That won't solve your problem, but it should get you started. If you want further help just say so. Denno
×
×
  • 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.