Jump to content

Jason28

Members
  • Posts

    132
  • Joined

  • Last visited

Everything posted by Jason28

  1. Hello, my original idea was for users to store a good amount of HTML in a DB using htmlspecialchars for security reasons. However I wonder if it would be better to just create text files and insert the user code in them to be pulled onto their webpage? Basically I am allowing users to create their own webpages but with limits.Thanks.
  2. Ah well nevermind I just threw some code together and it worked. Hopefully this is the best way to write it: $sql = "SELECT main_cat, genre_name FROM " . GENRES_TABLE . " WHERE main_cat > 0"; $result = mysql_query($sql); while ( $row = mysql_fetch_array($result) ) { echo $row['genre_name'] . '<br>'; $sql2 = "SELECT main_cat, genre_name FROM " . GENRES_TABLE . " WHERE sub_cat = '".$row['main_cat']."'"; $result2 = mysql_query($sql2); while ( $row2 = mysql_fetch_array($result2) ) { echo $row2['genre_name'] . '<br>'; } }
  3. Actually I am looking at other scripts DB info and they layout the mysql tables the same way so I will stick with that. I still need to figure out the php end to retrieve it. If no one helps I will just have to tinker with it.
  4. Ok thanks. I would still need a php example that displays the info in the organized format. Well this topic can go in either forum but since I need php code it should be ok to ask in here.
  5. It is hard for me to find a simple example of how to do this. I already created a db table that has the category name, and two fields "main_cat" and "sub_cat". The main cattegory will have values in the main cat table, and the sub categories will have the value of the main cat in their sub cat field I assume? So how what query would I use to display on a webpage such as: Main category name 1 - sub cat name 1 - sub cat name 2 - sub cat name 3 - and so on... Main category name 2 - sub cat name 1 - sub cat name 2 - sub cat name 3 - and so on... If you could provide me with a working php example that would be great. Thanks.
  6. Hello, can anyone provide me with a working code that allows me to click a button to add +1 to the current field? So if a field has the number 12, I can click on a button to make it 13. Thanks!
  7. Oh NM I found a working example finally if (document.forms[0].song_hifi.value.lastIndexOf(".mp3")==-1) { alert("Please upload only .mp3 extension file"); return false; }
  8. Hi it is me again Could anyone please give me a working example of javascript that checks to see if a field contains certain text and if it doesn't it errors? Kinda like preg_match() with php. I have one field that is used to upload .mp3 files only so I would like javascript to check that field to see if it contains .mp3 and if not it errors before the user uploads it. Thanks!
  9. I assume you wanted me to use: <!-- function check_music() { var box = document.form[0]; var el = ""; for(var i=0; i < box.length;i++){ if(box.name == 'music_fan'){ if(box.checked){ el = box.value; break; } } } if (document.forms[0].musician_name.value == "" && el == '1') { alert("The Musician field is empty. Please fill out this field."); document.forms[0].musician_name.focus();return(false) } } //--> Sorry didn't work.
  10. The only thing I can assume is for some reason the correct value of music_fan is not being pulled. Is there a way to test this using javascript? I know with php you can use an echo to see what the value is doing.
  11. Sorry that was just a typo in this topic the function names are the same. Ok, this works alone: function check_music() { if (document.forms[0].musician_name.value == "" && document.forms[0].music_fan.value == 1) { alert("The Musician field is empty. Please fill out this field."); document.forms[0].musician_name.focus();return(false) } } However if I want it so that if I add the && document.forms[0].music_fan.value == 1 it doesn't work.
  12. Can't I just fix the javascript function instead of rewritting everything? Plus I cannot easily modify my form option since it generated from a php function that is used a lot and I do not want to edit it for a simple popup message.
  13. Ok thanks. <form action="signup.php?action=page2" enctype="multipart/form-data" method="post" onSubmit="return check_music()"> <table width="65%" border="0" align="center" cellpadding="3" cellspacing="1" class="maintable"> <tr> <th class="thHead" colspan="2" height="25" valign="middle">Registration Information</th> </tr> <tr> <td class="row2 smalltext" colspan="2">Fields marked with an asterisk are required</td> </tr> <!-- BEGIN show/hide --> <tr class="row1"> <td width="38%" class="row1 bigtext">Account Type: * <br> <br> <span class="smalltext">Please choose between a musician or fan account. You can change this option later on after you have registered.</span> <br> <br> <a href="pop_up_window.php?action=fan_or_musician" target="_blank" onClick="openWin(this.href, '400', '600', 'yes'); return false;">More Info</a></td> <td class="row2 bigtext"> <table width="100%" border="0" cellpadding="4"> <tr align="center"> <td>{musician_img}</td> <td>{fan_only_img}</td> </tr> <tr align="center"> <td class="bigtext"><input name="music_fan" type="radio" value="1" onClick="javascript:showHide('div1'); showHide('div2')"> Musician and Fan</td> <td class="bigtext"><input name="music_fan" type="radio" value="0" checked="checked" onClick="javascript:alwaysHide('div1'); alwaysHide('div2')"> Fan Only</td> </tr> </table> </td> </tr> <tr id="div1" style="display:none"> <td class="row1 bigtext">Musician Name: *</td> <td class="row2"><input type="text" class="post" style="width: 250px" name="musician_name" size="25" maxlength="20" value=""></td> </tr> <tr id="div2" style="display:none"> <td class="row1 bigtext">Package Plan: *</td> <td class="row2">{row_plan_drop}</td> </tr> <!-- END show/hide --> <tr> <td class="row1 smalltext" colspan="2"> </td> </tr> <tr> <td class="catBottom" colspan="2" align="center" height="28"> <input type="submit" name="continue" value="Continue" class="mainoption" /> </td> </tr> </table> </form>
  14. Hello, I am new to javascript and tried modifying an existing script but it doesn't work. It is used to see if one option on a form is selected, and the other form field is empty, it will error. Here is what I modified: <script language="JavaScript" type="text/javascript"> <!-- function check_music() { if (form.music_fan.value == 1 && form.musician_name.value == "") { alert( "test." ); form.music_fan.focus(); return false ; } return true ; } //--> </script> and on the first <form I added: onSubmit="return checkme_signup()" There are no errors but it just continues to the next page. I used the php && so perhaps javascript uses something else for "and" or something. Basically I only want it to alert when the music_fan value is = 1 and the musician_name is empty. If the music_fan value is 0 or the musician_name is not empty it will not error. Thanks!
  15. Ok great I wanted to make sure that wasn't the only way I checked out your site that is impressive that you are only 19 and already know so much plus married
  16. Thanks bud I got it to work Sorry one last simple question. One one link I used: onClick="javascript:goHide('div1'); go('div2')" However I assume there is a better way to write that instead of calling the same function twice? If not no big deal. Thanks!
  17. Sorry an update, I want to use this other function instead of the first function I posted: function openWin() { win = window.open("test.php?action=view_users", "Window", "width=810,height=600,scrollbars=yes"); } Please let me know how to pass vars from a webpage into this function. Thanks!
  18. Hello, I would like to pass variables into an existing function. Here is a popup function that I like using: function openpopup(popurl) { winpops=window.open(popurl,"","width=650,height=493,scrollbars=yes") } and it is called up by using a link such as: <a href="terms.php" onclick="openpopup(this.href);return false">Terms</a My question is that can you give me a working example so that I can pass the height, width, and scrollbars vars from the link into the function? That way I can just pass those vars from different urls so I can have different size popups for each link. Thanks!
  19. Yes you were very helpful but too bad I couldn't figure it out to make it work
  20. BTW the ajax code is displaying errors: http://img231.imageshack.us/img231/6195/ajaxerrorqj7.jpg I hope that you come back soon. Thanks.
  21. Please let me know whenever you come back online
  22. No sorry I didn't see your edit until you mentioned it now Sure I will try it but if I cannot get it to work can I simply pay you for this? I have this script written from scratch on a test site it is very clean and easy to read. Thanks. EDIT In fact I am so busy I don't even feel like attempting to figure this out can you do this for me? Thanks.
  23. I need to use GET so when I click on a link it simply displays the rows from my DB.
×
×
  • 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.