Jump to content

codefossa

Members
  • Posts

    583
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by codefossa

  1. The required attribute is being used on your file select. Remove that and it will become optional.
  2. If you're getting them ready to send to another page, you could check out serialize() for the form. Give each of the sets of checkboxes a different name and they'll be set up and separated for you to deal with in PHP. On a side note .. This is Javascript. Java is so completely different that it has absolutely nothing to do with anything here.
  3. You can check this out: http://xaotique.no-ip.org/tmp/17/ View the source and you should get your answer. If you have any questions, feel free to ask, but please use a code box because I don't feel like bothering to look through plain text.
  4. Please use code tags when you show any code. It makes it much easier to look through. Without changing a whole lot of your code .. Demo: http://xaotique.no-ip.org/tmp/28/ <html> <head> <script language="javascript"> window.addEventListener("load", function() { window.document.frmname.addEventListener("submit", function(e) { e.preventDefault(); var str= ''; if (document.getElementById('name1')) { if (document.getElementById('name1').value == '') { alert('Cannot be left Blank'); document.getElementById('name1').focus(); return false; } } str = "Short1.php"; document.frmname.action = str; document.frmname.submit(); }, false); }, false); </script> </head> <body> <form name='frmname' method='post'> <input type="text" name="name1" id="name1"> <input type="text" name="name2" id="name2"> <input type="text" name="name3" id="name3"> <input type="submit" value="shorten"> </form> </body> </html>
  5. So you want each number for each of them or what? That would be a ton of lines. I don't really see what you're trying to do.
  6. Assuming you can just create the links, here's an example. Demo: http://xaotique.no-ip.org/tmp/27/ Javascript window.addEventListener("load", function() { var img = [ 250, 500, 800, 1000 ]; var btn = window.document.querySelectorAll(".btn"); var txt = window.document.querySelectorAll(".txt"); btn[0].addEventListener("click", function() { var input = txt[0].value.split(', '); txt[1].value = ""; for (var i in input) { var num = [ input[i], input[i].substr(0, input[i].length - 3) + "000"]; if (i > 0) txt[1].value += "\n"; for (var n in img) { txt[1].value += "http://www.mysite.com/file/folder/blah/" + num[0] + "/_something_else here/" + num[1] + "/image" + img[n] + "\n"; } } }, false); btn[1].addEventListener("click", function() { for (var i in txt) { txt[i].value = ""; } txt[0].focus(); }, false); }, false);
  7. What does the date come out as for the value of v2? (show it to me as a string)
  8. Show an example of the URL and say what you want out of it?
  9. You would float all three of them left and it would work. The only way it won't work is if you got the dimensions wrong or something.
  10. Check out Ajax and jQuery makes it so much easier. I don't have time to link to a bunch at the moment but check out $.post() and $.load().
  11. I'm gonna play Santa, just because I was bored. Demo Page: http://xaotique.no-ip.org/tmp/26/ HTML <table> <tr> <td class="link">New Word</td> <td class="desc"></td> </tr> <tr> <td class="link">Translation</td> <td class="desc"></td> </tr> </table> CSS table { text-align: center; } .link { color: #000077; } .link:hover { cursor: pointer; } .desc { color: #252525; text-align: left; } Javascript // Allow the page to load first. window.addEventListener("load", function() { // Function for generating random numbers. function random(from, to) { return Math.floor(Math.random() * (to - from + 1)) + from; } // Array of words and their translation. var words = { 'king': 'kong', 'ele': 'phant', 'drag': 'on', 'php': 'freaks' }; // Array of our link class. var links = window.document.querySelectorAll(".link"); // Cycle through the array. for (var i in links) { // Set an onclick function. links[i].addEventListener("click", function() { // New word or translation? if (this.innerHTML == "New Word") { // Clear and set new word. window.document.querySelectorAll(".desc")[1].innerHTML = ""; window.document.querySelectorAll(".desc")[0].innerHTML = Object.keys(words)[random(0, Object.keys(words).length - 1)]; } else { // Show translation. window.document.querySelectorAll(".desc")[1].innerHTML = words[window.document.querySelectorAll(".desc")[0].innerHTML]; } }, false); } }, false);
  12. I use Geany as well. A very lightweight, free IDE and has plugin support for a few missed features. Also available in Ubuntu repos. (:
  13. <?php $site = 'http://example.com'; $wait = 2; // Seconds ?> <meta http-equiv="refresh" content="<?php echo $wait; ?>;url=<?php echo $site; ?>" /> You're being redirected to <?php echo $site; ?>.
  14. Okay, so there's no key to call on, therefore I'm assuming you want to loop through them all. What I don't understand is why you would use an array within an array making the inner array the first item of the outer array, which is pointless unless there's multiple arrays in it. A more sensible array would be something like: $data = array( 'key1' => array(1, 2, 3), 'key2' => array(1, 2, 3), 'key3' => array(1, 2, 3) ); Then you could call on it by the key of choice (as it looks like you were trying to do by the previous posts). $data = array( 'key1' => array(1, 2, 3), 'key2' => array(4, 5, 6), 'key3' => array(7, 8, 9) ); $var = 'key2'; foreach ($data[$var] as $item) { echo "{$item}<br />"; } Outputs 4 5 6 Hopefully I'm correct on what you're trying to do.
  15. Is this what you're trying to do? $var = 'key'; $data['key'] = array( 'item0', 'item1', 'item2' ); foreach ($data[$var] as $item) { echo "{$item}<br />"; } Will output: item0 item1 item2
  16. $var should be a string as you're using it as a key.
  17. $data needs to be an array, not a string. Also, you shouldn't use count() in a loop like that. Just store it in a variable before the loop.
  18. One of many ways to do it .. <?php $session_id = session_id(); if (empty($session_id)) session_start(); if (isset($_POST['guess'])) { if ($_POST['guess'] == $_SESSION['number']) { echo "You Win! "; unset($_SESSION['number']); } else { $_SESSION['tries']++; if ($_SESSION['tries'] < 3) { echo "Try #{$_SESSION['tries']}<br /><br />"; } else { echo "Try #3 : You Lose "; unset($_SESSION['number']); } } } if (empty($_SESSION['number'])) { $_SESSION['tries'] = 0; $_SESSION['number'] = rand(1, 10); } ?> <html> <head> <title>Guessing Game</title> </head> <body> <form method="post" action=""> <label for="guess">Guess</label> <select name="guess" id="guess"> <?php for ($i = 1; $i < 11; $i++) { echo "<option value='{$i}'>{$i}</option>"; } ?> </select> <input type="submit" value="Guess" /> </form> </body> </html>
  19. Code box. >_< <?php require THEMES_INCLUDES . "overall.header.php"; ?> <link rel="stylesheet" type="text/css" href="css/form.css" /> <script type="text/javascript" src="js/search.js"></script> <script type="text/javascript"> function thisMovie(movieName) { if(navigator.appName.indexOf("Microsoft") != -1) { return window[movieName]; } else { return document[movieName]; } }; function loadNewFile(mainAudio, overAudio, audioName, buyLink) { var currName = thisMovie("player"); currName.loadNewSet(mainAudio, overAudio, audioName, buyLink); } </script> <table width="960" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="210" align="left" valign="top"><?php require THEMES_INCLUDES . "overall.left.php"; ?></td> <td width="540" align="center" valign="top"><table width="520" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="left" valign="top" class="headimg_text" style="padding-left:5px;">Advance Search</td> </tr> <tr> <td align="left" valign="top"> </td> </tr> <tr> <td align="center" valign="top"><table width="520" border="0" cellpadding="0" cellspacing="0" class="cbox_bg" align="center"> <tr> <td align="justify" valign="top" style="padding:5px;"> </td> </tr> <form action="" method="get" name="form" id="form" onsubmit="return validate(this)"> <tr> <td align="center" valign="top" style="padding:5px;"><table width="90%" border="0" cellspacing="0" cellpadding="4" align="center"> <tr> <td width="26%" align="left" valign="middle" class="text_font"><span class="errfont">* </span>Producer</td> <td width="2%" align="left" valign="middle" class="text_font">:</td> <td width="72%" align="left" valign="middle"> <select name="pid" class="medium_input_text" id="pid"> <option value="">Select</option> <?php $producers = Beats::getAllProducers(); if (count($producers) > 0): foreach ($producers as $k => $mod): ?> <option value="<?php echo $mod['id'] ?>"><?php echo $mod['name'] ?></option> <?php endforeach; endif; ?> </select> </td> </tr> <tr> <td align="left" valign="middle" class="text_font"><span class="errfont">*</span> Genre</td> <td align="left" valign="middle" class="text_font">:</td> <td align="left" valign="middle"> <select name="gid" class="medium_input_text" id="gid"> <option value="">Select</option> <?php $gdatas = Beats::getAllGenres(); if (count($gdatas) > 0): foreach ($gdatas as $k => $gdata): ?> <option value="<?php echo $gdata['id'] ?>"><?php echo $gdata['name'] ?></option> <?php endforeach; endif; ?> </select> </td> </tr> <tr> <td align="left" valign="middle" class="text_font"> <span class="errfont"> </span> Beat</td> <td align="left" valign="middle" class="text_font">:</td> <td align="left" valign="middle"> <input type="text" name="beat" class="medium_input_text" > </td> </tr> <tr> <td align="center" valign="middle" colspan="3" style="padding-top:10px;"><input type="submit" name="advsearch" value="Search" class="button"></td> </tr> </table> </td> </tr> </form> <tr> <td align="justify" valign="top" style="padding:5px;"> </td> </tr> </table> </td> </tr> <tr> <td align="justify" valign="top" style="padding:5px;"> </td> </tr> <?php //if(isset($gets['advsearch'])): ?> <?php if (count($searchresults) > 0): ?> <tr> <td align="left" valign="top" class="headimg_text" style="padding-left:5px;">Advance Search Result</td> </tr> <tr> <td align="left" valign="top"> </td> </tr> <tr> <td align="left" valign="top"><table width="520" border="0" cellpadding="0" cellspacing="0" class="box_bg"> <tr> <td align="center" valign="middle" style="padding-top:10px;"> <?php if (isset($gets['fileid'])) { $id = $gets['fileid']; $beatfile = Beats::getDetail($id); } ?> <span style="padding:10px;"> <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="500" height="50" id="player" align="middle"> <param name="allowScriptAccess" value="sameDomain" /> <param name="allowFullScreen" value="false" /> <param name="flashVars" value="colorCode=0x<?php echo $cssplayer['button_color']; ?>" /> <param name="movie" value="player/player.swf" /> <param name="quality" value="high" /> <param name="bgcolor" value="#<?php echo $cssplayer['box_bg_color']; ?>" /> <embed src="player/player.swf" quality="high" bgcolor="#<?php echo $cssplayer['box_bg_color']; ?>" width="500" height="50" flashVars="colorCode=0x<?php echo $cssplayer['button_color']; ?>" name="player" align="middle" allowscriptaccess="sameDomain" allowfullscreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></embed> </embed> </object> </span></td> </tr> </table></td> </tr> <tr> <td align="left" valign="top"> </td> </tr> <tr> <td align="center" valign="top"><table width="520" border="0" cellpadding="0" cellspacing="0" class="" align="center"> <tr> <td align="center" valign="top" style="padding:5px;"><table width="520" border="0" cellpadding="0" cellspacing="0" class="details_box_head"> <tr> <td height="34" align="center" valign="middle"><table width="520" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="110" align="center" valign="middle">TITLE</td> <td width="100" align="center" valign="middle" >GENRE</td> <td width="100" align="center" valign="middle">PRODUCER</td> <td width="58" align="center" valign="middle">PRICE</td> <td width="69" align="center" valign="middle">LICENSE</td> <td width="40" align="center" valign="middle">PLAY</td> <td width="110" align="center" valign="middle"><?php echo DL_LABEL; ?></td> </tr> </table></td> </tr> <tr> <td height="20" align="center" valign="top"><table width="512" border="0" cellpadding="0" cellspacing="0" class="details_box_bg"> <tr> <td align="center" valign="top"><table width="512" border="0" cellspacing="0" cellpadding="0"> <?php $count = 0; ?> <?php foreach ($searchresults as $k => $beat): ?> <?php $producer = Beats::getProducerDetail($beat['producer_id']); ?> <?php $genres = Beats::getGenreDetail($beat['genres_id']); ?> <tr> <td width="70" align="center" valign="middle" class="line_border2" id="slidingProduct<?php echo $beat['id']; ?>"><div class="sliding_product"> <div title="<?php echo $beat['title']; ?>" style="overflow:hidden;width:70px;white-space: <?php echo $cssplayer['css_1']; ?>; text-overflow: ellipsis"><?php echo $beat['title']; ?></div> </div></td> <td width="67" align="center" valign="middle" class="line_border1"><div title="<?php echo $genres['name']; ?>" style="overflow:hidden;width:67px"><?php echo $genres['name']; ?></div></td> <td width="67" align="center" valign="middle" class="line_border1"><div title="<?php echo $producer['name']; ?>" style="overflow:hidden;width:67px"><a class=""href="<?php echo $producer['name']; ?>"><?php echo $producer['name']; ?></a></div></td> <td width="45" align="center" valign="middle" class="line_border1"><?php echo C_SYMBOL . '' . $beat['price']; ?></td> <td width="50" align="center" valign="middle" class="line_border1"><?php echo $beat['license']; ?></td> <td width="25" align="center" valign="middle" class="line_border1"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="20" height="20" id="smallPlayer2" align="middle"> <param name="allowScriptAccess" value="sameDomain" /> <param name="allowFullScreen" value="false" /> <param name="flashVars" value="mainAudio=<?php echo "audio-" . $beat['id']; ?>&overAudio=voice/<?php echo $cssplayer['voice_tag']; ?>&colorCode=0x<?php echo $cssplayer['button_color_b']; ?>&audioName=<?php echo $producer['name']; ?> - <?php echo $beat['title']; ?> - <?php echo C_SYMBOL . '' . $beat['price']; ?> - <?php echo $genres['name']; ?>" /> <param name="movie" value="player/smallPlayer.swf" /> <param name="quality" value="high" /> <param name="bgcolor" value="#<?php echo $cssplayer['details_box_bg']; ?>" /> <embed src="player/smallPlayer.swf" quality="high" bgcolor="#<?php echo $cssplayer['details_box_bg']; ?>" width="20" height="20" flashVars="mainAudio=<?php echo "audio-" . $beat['id']; ?>&overAudio=voice/<?php echo $cssplayer['voice_tag']; ?>&colorCode=0x<?php echo $cssplayer['button_color_b']; ?>&audioName=<?php echo $producer['name']; ?> - <?php echo $beat['title']; ?> - <?php echo C_SYMBOL . '' . $beat['price']; ?> - <?php echo $genres['name']; ?>" name="smallPlayer002" align="middle" allowscriptaccess="sameDomain" allowfullscreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></embed> </embed> </embed> </object> </a></td> <?php if ($flag_download == 'true') { ?> <td width="60" class="download"><a href="download.php?id=<?= $order_id ?>&b_file=<?= $beat['beat_file'] ?>"><?php echo DL_LABEL; ?> </a></td> <?php } else { ?> <td width="57" align="center" valign="middle" class="line_border"><a class="download" href="#" onclick="addToBasket(<?php echo $beat['id']; ?>);return false;"><?php echo DL_LABEL; ?></a></td> <?php } ?> </tr> <?php $count = $k + 1; ?> <?php endforeach; ?> </table></td> </tr> <?php if ($allnewestbeat > $count): ?> <?php endif; ?> </table></td> </tr> </table></td> </tr> <tr> <td align="center" valign="top" style="padding-top:10px;" class="next"><?php echo $searchresultPaging; ?></td> </tr> <tr> <td align="center" valign="top" style="padding:5px;"> </td> </tr> </table></td> </tr> <?php elseif (isset($searchresults)): ?> <tr> <td align="center" valign="top"><table width="520" border="0" cellpadding="0" cellspacing="0" class="box_bg" align="center"> <tr> <td align="center" valign="top" style="padding:5px;">No Result Found.</td> </tr> </table></td> </tr> <?php //endif; ?> <?php endif; ?> <tr> <td align="left" valign="top"> </td> </tr> </table></td> <td width="210" align="left" valign="top"><?php require THEMES_INCLUDES . "overall.right.php"; ?></td> </tr> </table> <?php require THEMES_INCLUDES . "overall.footer.php"; ?>]
  20. Why query SQL to get 90 days from the current time? $then = strtotime("90 days"); echo date('F d, Y', $then);
  21. $_SESSION['vars'] = 'a=1&b=2&c=3'; header("Location: http://example.com/?{$_SESSION['vars']}");
  22. If you're posting to that page, but you could use session and only have to post once at the end of the form. Also, you shouldn't use short tags. value="<?php echo $_POST['pending']; ?>" You're just a little off. You gotta echo the variable, and you should use delimiter.
  23. A much easier way would be simply: $stars = round($rating);
  24. This may help, though I haven't used it or the zip class, so I can't confirm it. http://ramui.com/articles/php-zip-files-and-directory.html
×
×
  • 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.