Jump to content

amg182

Members
  • Posts

    130
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

amg182's Achievements

Member

Member (2/5)

0

Reputation

  1. <select name='drop'> <option "Input" value="choose from list"></option> <?php $combo = "SELECT field FROM table"; $result = mysql_query($combo) or die(mysql_error()); while($row = mysql_fetch_array($result)){ echo "<option value='". $row['field'] ."'>". $row['field'] ."</option>"; } ?> </select> Hope this helps
  2. Not sure if this is possible, but if anyone knows it's you guys. Can I echo out the logged in user profile name of a windows PC onto a webpage? for example "Welcome John Desktop". I can get it to echo out the PC Name but not the user currently logged in. Any help would be greatly received. Thanks in anticipation.
  3. Cheers guys, that worked a treat! Merry Xmas to you all. Aidan
  4. Hi guys. I need to destroy a session when a user leaves a particular page. I tried using session_destroy() at the end of the page but its not possible, because my page has pagination. i.e. abc.php?page=1 etc... So, I need to destroy a session when a user leaves abc.php page. Thanks in advance Aidan
  5. If you want some form of validation for your postcode consider this one way of doing it. It ensure the correct format is entered i.e Letter Numbers etc....(Uk Postcodes) function IsPostcode($postcode) { $postcode = strtoupper(str_replace(' ','',$postcode)); if(preg_match("/^[A-Z]{1,2}[0-9]{2,3}[A-Z]{2}$/",$postcode) || preg_match("/^[A-Z]{1,2}[0-9]{1}[A-Z]{1}[0-9]{1}[A-Z]{2}$/",$postcode) || preg_match("/^GIR0[A-Z]{2}$/",$postcode)) return true; else return false; } $codevalid=$postcode; if (IsPostcode($codevalid)) echo "Valid"; else echo "Invalid"; Hope this helps.
  6. Need much more info... are you referring to a mysql database table?
  7. You are a true gentleman! This is a great way to show error messages! Once again thank you ever so much, I really appreciate it- A credit to the forum!
  8. hi again. How would i go about placing one alert messagee if one or more fields are left blank/empty? i.e. A message saying "Please fill in ALL fields" I can manage to do it for each input field but obiviously not practical if there are 5+ fields left blank otherwise the user is bombarded wiht alert messages! Thanks again
  9. Thanks a million nogray! Worked a treat! Much appreciated
  10. Hi guys, any help with this would be much appreciated. I have some JS validating my form to check that the fields are not empty/balnk- if they are it will highlight the fields (using css classes). It is working fine but only highlights one empty field at a time. Is it possible to get it to highlight all the fields that are empty/blank? For example. If the user forgets to fill in 2 fields, it will highlight one field at a time. If the user then inputs something to that field and tries to submit it will then highlight the next filed. Instead, is it possible to have it highlight ALL empty fields? function validateForm() { var x=document.forms["advert"]["name"].value; if (x=="") { //changes class of li_25 to error class in order to highlight field document.getElementById("li_25").className = "error"; return false; } var x=document.forms["advert"]["email"].value; if (x=="") { document.getElementById("li_36").className = "error"; return false; } var x=document.forms["advert"]["age"].value; if (x=="") { document.getElementById("li_17").className = "error"; return false; } } Thanks guys
  11. Hi teynon. That worked a treat! Thanks a million mate!
  12. Hi. Complete beginer with java.... Is it possible to change a html class depening on variable using javascript. For example if a user left a form input blank then javascript would change the css class to highlight it red. Here is what i am working with: function validateForm() { var x=document.forms["form"]["fieldname"].value; if (x==null || x=="") { alert("Fields in red need to be filled in"); var class ="class='error'"; return false; } } Thanks guys
  13. Thanks Pikachu2000. This is much more effecient! I was going about this totally wrong. Oh well, its a learning curve...as you can see i have a lot to learn. Thanks again! A credit to the forum.
  14. I am trying to echo out a particular comment depending on what is entered witihn a form(text input). So if someone enters a value between 1-1000 it would echo out "Under 1000". The problem i have is that i users can enter a value between 0 - 100,000. Ideally i would like the text echo out to the nearest thousand so if someone entered 5400 it would echo out "under 6000". Any ideas? Thanks again.
  15. Thanks for reply, worked a treat. How could i add this to the array ? (5,10,'under 10') Thanks again
×
×
  • 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.