Jump to content

The Praetorian

Members
  • Posts

    333
  • Joined

  • Last visited

Everything posted by The Praetorian

  1. Firefox doesn't report any errors. It runs the page fine and seems to ignore the script altogether.I looked at both forms, and they both seem to be the same. Only slightly different because one form is longer than the other.As for that validation script, could you be more specific? heh. I don't really know a whole lot about writing javascript.
  2. Bump.Anyone have any ideas on this one?After some random testing.. I discovered that this script has only stopped working on Firefox. It still works on IE and on Opera. Very confusing.
  3. It's because it's on your computer. You have to be running a local server to have javascript or php execute on your computer. Check out XAMPP server. Easy program to set up and run.
  4. Well, I removed the <!-- --> from the js file and it still won't work.Honestly I think it's the other javascript that I have, because I'm using this validation script on another mail form and it works fine. Same script. For some reason I think adding the collapse/expand script messed up the other one.. but I'm not sure how...
  5. Hi. I'm using this script ... Here ... to validate my mail form to make sure people aren't sending in blank forms. It worked fine until I added this code. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><head><title>The Shattered Realms ~ Application</title><?php include 'meta.txt'?><link rel="stylesheet" type="text/css" href="new.css" media="all" /><script type="text/javascript" language="javascript" src="app.js"></script><script type="text/javascript" language="javascript">function hideshow(which){ if (!document.getElementById) return; var spans = document.getElementsByTagName("span"); for(var i = 0; i < spans.length; i++) { if(spans[i].className == "hide") spans[i].style.display = "none"; } if (which.style.display != "inline") which.style.display = "inline";}</script><style type="text/css">.hide {display:none;}</style></head><body><table border="0" cellspacing="2" cellpadding="0" class="table" align="center"> <tr> <td colspan="2"> <?php include 'menutop.txt'?> </td> </tr> <tr> <td class="lnavigate" valign="top"> <?php include 'menu.txt'?> </td> <td class="content" valign="top"> <div class="header">~ The Application ~</div> <div class="maincontent"><form method="post" action="appmail.php" name="app" onsubmit="return ValidateRequiredFields();"><h1>Character Information</h1><br /><p>* : Required Fields</p><p><b>* Name</b><br /><input type="text" name="CharacterName" size="20" /><br /></p><p><b>* Nationality</b> ( + Requires you to choose a Race/Sub-species )<br /><input type="radio" name="Nation" value="Ihthian" onclick="hideshow(document.getElementById('raceone'))" /> : Ihthian +<span id="raceone" class="hide"> | Pahth : <input type="radio" name="Race" value="Pahth" /> Roehn : <input type="radio" name="Race" value="Roehn" /> Theyhn : <input type="radio" name="Race" value="Theyhn" /> Ohnen : <input type="radio" name="Race" value="Ohnen" /></span><br /><input type="radio" name="Nation" value="Siyk" /> : Siyk<br /><input type="radio" name="Nation" value="Shani" /> : Shani<br /><input type="radio" name="Nation" value="Ush'ii" /> : Ush'ii<br /><input type="radio" name="Nation" value="Ikarri" onclick="hideshow(document.getElementById('racetwo'))" /> : Ikarri +<span id="racetwo" class="hide"> | Kiil : <input type="radio" name="Race" value="Kiil" /> Iken : <input type="radio" name="Race" value="Iken" /></span><br /></p><p><b>* Age</b> : <input type="text" name="CharacterAge" size="2" /></p><p><b>* M:</b><input type="radio" name="Gender" value="Male" /> <b>F:</b><input type="radio" name="Gender" value="Female" /></p><p><b>Shapers</b> <input type="checkbox" name="Guild" value="Yes" /><br />Check this box if you would like your character to be a Shaper.<br />(<b>Required reading: </b><a href="laws.php" target="_blank">The Laws of the Deep</a>, <a href="pathfinders.php" target="_blank">The Pathfinders</a>.)</p><p><b>* Brief History</b><br /><textarea name="History" rows="15" cols="52"></textarea></p><p><b>* Writing Sample</b><br /><textarea name="WritingSample" rows="15" cols="52"></textarea></p><br /><h1>Personal Information</h1><p>Please be honest. None of this information will be given out to anyone.</p><p><b>* Email</b><br /><input name="Email" type="text" size="20" /></p><p>Needless to say, please make sure your email is correct, otherwise you could be waiting a long time to hear back from us.</p><p><b>Name/Alias</b><br /><input name="Alias" type="text" size="20" /></p><p>This isn't a required field. If you want to put your first name here you can, or you can put a nickname you'd like people to use. It's entirely up to you.</p><p><b>* Age</b> : <input name="YourAge" type="text" size="2" /></p><p><b>M:</b><input type="radio" name="YourGender" value="Male" /> <b>F:</b><input type="radio" name="YourGender" value="Female" /></p><p><b>ICQ</b><br /><input type="text" name="Icq" size="20" /></p><p><b>AIM</b><br /><input type="text" name="Aim" size="20" /></p><p><b>MSN</b><br /><input type="text" name="Msn" size="20" /></p><h1><input type="submit" value="Apply" class="button" /></h1></form> </div> </td> </tr> <tr> <td colspan="2" align="right" class="copyright"><p>The Shattered Realms © 2006 David Ash. All Rights Reserved.</p></td> </tr></table></body></html>
  6. Okay. That one works.And now I realize I may need something a little more complicated. heh. As you can see, I have several other radio buttons on the same level as the ones with sub-options. How complicated would it be to make it so that if any other radio buttons on the same level are selected, the hidden content disappears again?(IE.. if someone chooses 1 [which opens the sub-choices] and then changes their mind and chooses 2 [with no sub-choices] the sub choices for 1 would close even though nothing else is opening.)Is that possible?Again, if that would be too much of a hassle, let me know and I'll be satisfied with what I have.Thanks guys.
  7. Either I didn't do that right, or it doesn't work with what I have set up. Lemme show you what I did.Javascript function hideshow(which){ if (!document.getElementById) return; var divs = document.getElementsByTagName("div"); for(var i = 0; i < divs.length; i++) { if(divs[i].className == "SubContent") divs[i].style.display = "none"; } if (which.style.display != "inline") which.style.display = "inline";} html <p><b>* Nationality</b> ( + Requires you to choose a Race/Sub-species )<br /><input type="radio" name="Nation" value="Ihthian" onclick="hideshow(document.getElementById('raceone'))" /> : Ihthian +<span id="raceone" class="hide"> | Pahth : <input type="radio" name="Race" value="Pahth" /> Roehn : <input type="radio" name="Race" value="Roehn" /> Theyhn : <input type="radio" name="Race" value="Theyhn" /> Ohnen : <input type="radio" name="Race" value="Ohnen" /></span><br /><input type="radio" name="Nation" value="Siyk" /> : Siyk<br /><input type="radio" name="Nation" value="Shani" /> : Shani<br /><input type="radio" name="Nation" value="Ush'ii" /> : Ush'ii<br /><input type="radio" name="Nation" value="Ikarri" onclick="hideshow(document.getElementById('racetwo'))" /> : Ikarri +<span id="racetwo" class="hide"> | Kiil : <input type="radio" name="Race" value="Kiil" /> Iken : <input type="radio" name="Race" value="Iken" /></span><br /></p>
  8. I probably should have mentioned sooner that I know very little about Javascript. The second option sounds like it would be the one I'd want to use, but I have no notion of how to code what would go in those if statements.
  9. Okay. Need some help with this one. I'm using this script to validate my form (to make sure there are no blank fields). It worked fine before, but one of the required fields I changed from a text input to a radio button, and now it won't work unless I remove that required field from the javascript. <!-- Copyright 2005 Bontrager Connection, LLC//// Two places need to be customized.////// Place 1:// Between the quotation marks, specify the name of// your form.var FormName = "app";// Place 2:// Between the quotation marks, specify the field names// that are required. List the field name separated// with a comma.var RequiredFields = "CharacterName,Nation,CharacterAge,History,WritingSample,Email";//// No other customization of this JavaScript is required.///////////////////////////////////////////////////////////function ValidateRequiredFields(){var FieldList = RequiredFields.split(",")var BadList = new Array();for(var i = 0; i < FieldList.length; i++) {var s = eval('document.' + FormName + '.' + FieldList[i] + '.value');s = StripSpacesFromEnds(s);if(s.length < 1) { BadList.push(FieldList[i]); }}if(BadList.length < 1) { return true; }var ess = new String();if(BadList.length > 1) { ess = 's'; }var message = new String('\n\nThe following field' + ess + ' are required:\n');for(var i = 0; i < BadList.length; i++){if (BadList[i] == "CharacterName"){BadList[i] = "Character Name";}if (BadList[i] == "CharacterAge"){BadList[i] = "Character Age";}if (BadList[i] == "WritingSample"){BadList[i] = "Writing Sample";}if (BadList[i] == "Nation"){BadList[i] = "Nationality";}message += '\n' + BadList[i];}alert(message);return false;}function StripSpacesFromEnds(s){while((s.indexOf(' ',0) == 0) && (s.length> 1)) {s = s.substring(1,s.length);}while((s.lastIndexOf(' ') == (s.length - 1)) && (s.length> 1)) {s = s.substring(0,(s.length - 1));}if((s.indexOf(' ',0) == 0) && (s.length == 1)) { s = ''; }return s;}// -->
  10. Ignore the post above. I figured that one out. I do have another question though regarding this script.I'm using radio button inputs, and I'd like to edit this script so that when someone changes their selection from one radio button to another, the previous one's hidden content closes. (I guess make it so that only one can be open at a time, if that's possible. Either that or just make it so that the previous one closes.)If it's not possible or it would be too complicated, that's fine. Just thought I'd ask. Here's the script again. function hideshow(which){if (!document.getElementById)returnif (which.style.display=="inline")which.style.display="none"elsewhich.style.display="inline"}
  11. Okay. Minor problem. Not too big a deal if I can't fix it, but I just thought I'd ask.It works fine and everything, but when the hidden object appears it appears on a new line, even though I'm not using a line break. Is there any way to get it to appear on the same line?Here's the html. The javascript is the same as above. <p><b>* Nationality</b><br />Ikarri : <input type="checkbox" name="Nation" value="Ikarri" onclick="hideshow(document.getElementById('Kiil'))" /> <input type="checkbox" name="Race" value="Kiil" id="Kiil" /></p>
  12. I was just wondering if anyone could help me edit this script. I'd like to use this hide/reveal script so that when someone clicks a checkbox or radio button (whichever I decide to use) it reveals whatever was hiding. And it disappears again if they unclick it. I've tried this before with a different hide/reveal script I'm using on my website, but it didn't work. I'd also need to know what switch to use in the select tag. (IE... onclick/onselect/onchange... ) Thanks in advance for any help.Here's the script. function hideshow(which){if (!document.getElementById)returnif (which.style.display=="block")which.style.display="none"elsewhich.style.display="block"}
  13. Nope. Didn't work...I'm so confused... Is it possible that it's my images? I'm using images for the background color of the <select> boxes. Could that be causing it?
  14. Doh! That's the wrong link. This is the file I'm having problems with.http://www.tsrealms.com/appmail.shtmlThe one I sent you to was the processing page.
  15. Just above the <select> tags. There is text that says... for instance... "+ requires you to choose a race" that keeps disappearing. At least on my computer.
  16. I submitted this before and no one was able to come with an answer. I'm hoping someone might still be able to help me because I've yet to figure out a solution for this problem.On this page... Application... when looking at it in IE (I've tried 6 and 7 and they both have the same problem) part of the text appears and disappears when scrolling. And I can't for the life of me figure out why.Just in case it's in there somewhere, here's the css for that page.CSS
  17. Hm. I should be okay then...I have 9 pages using connection strings and queries. Mainly to pull out information based on links clicked. But I don't think I have any loops like the one you posted. The only loops I have are if, else loops, each with a different query.Thanks for the info.
  18. How do php connection strings and sql queries effect the load time of a page?I'm using php and sql to store most of the content of my website and it works fine for me, but I have a high-speed connection, and the site isn't really fully up and running. I'm just curious how those two things will effect load times once I start getting a lot of traffic.
  19. I'm using a lot of php/sql stuff for my website, but very little of it actually involves forms. (The only forms I use are for email, so they're not connected to the database). How safe is the information on the sql database? Is it safe so long as I don't have any forms connected to the database?
  20. If I want to use an apostrophe, do I need to escape it somehow? Here's the example..echo "<title>The Shattered Realms ~ Ush'en: $r[header]</title>";Is that good enough or will that cause me problems?
  21. Nevermind. Figured it out based on what you gave me. Thanks very much guys.
  22. Okay. I took out the while loop. But now none of the other entries will show up when I point to them. ( .php?s=entry ).
  23. Eh. I added that line to the wrong file. Fixed that, but it still isn't working right. It's showing the second entry, not the first one. Even clicking the link to the first entry won't make it show up. Here's the code as it looks now.This is everything underneath the connection string. $result = mysql_query ("SELECT * FROM siymeha ORDER BY id") or die(mysql_error()); $r = mysql_fetch_assoc($result); // the first row while($r = mysql_fetch_array($result)) { echo '<h1>'.$r['header'].'</h1>'; echo $r['content']; echo "<br />"; echo "<title>The Shattered Realms ~ Siymeha: $r[header]</title>"; }
  24. Okay the second one worked fine. The first one didn't. I copied it in exactly (replacing my previous query) but when I visit the page none of the data comes out.
  25. The Praetorian

    Minor help

    I'm using this script for my dictionary and for some of my other pages. I'd like to add a line so that only one entry at a time is shown.Well, we might need to do different things for each one.For this script.. I want to add a line so that, if someone visits the main page (.php without any ?s=something) only the first entry in that table is shown. (I do have them set on auto-increment, if that helps.) That way all the other entries will be hidden unless they're pointed at. <?php $dbh=mysql_connect ("localhost", "****", "****") or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ("author_localhost"); $result = mysql_query ("SELECT * FROM ihthia WHERE header LIKE '$_GET[s]%'") or die(mysql_error()); while($r = mysql_fetch_array($result)) { echo '<h1>'.$r['header'].'</h1>'; echo $r['content']; echo "<br />"; echo "<title>The Shattered Realms ~ Ihthia: $r[header]</title>"; }?> For this one, I just need it to pull out exactly what it's pointed at (the s= part.) And nothing else. So that way it doesn't pull out similar entries that are one or two letters off. I just want it to get exactly what it's pointed at. <?php $dbh=mysql_connect ("localhost", "****", "****") or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ("author_localhost"); $result = mysql_query ("SELECT * FROM dictionary WHERE word LIKE '$_GET[s]%'") or die(mysql_error()); while($r = mysql_fetch_array($result)) { echo '<h2>'.$r['word'].'</h2>'; if ($r['category'] != "") echo '<span class="blue">Category</span> <b>:</b> '.$r['category'].'<br />'; if ($r['pronounce'] != "") echo '<span class="blue">Pronunciation</span> <b>:</b> '.$r['pronounce'].'<br />'; if ($r['definition'] != "") echo ''.$r['definition'].'<br />'; if ($r['definitiontwo'] != "") echo ''.$r['definitiontwo'].'<br />'; if ($r['related'] != "") echo '<span class="blue">Related Entries</span> <b>:</b> '.$r['related'].'<br />'; echo "<br />"; echo "<title>The Shattered Realms ~ Search: $r[word]</title>"; }?> Thanks in advance for any help.
×
×
  • Create New...