Jump to content

siwelis

Members
  • Posts

    135
  • Joined

  • Last visited

Everything posted by siwelis

  1. [ RESOLVED WITH THIS FIX ] In the JavaScript portion mentioned in the previous post, I changed for (i=0;i<myarray.length;i++) { var optn = document.createElement("OPTION"); optn.text = myarray[i][0]; optn.value = myarray[i][1]; document.testform.subcat.options.add(optn); } That was the hardest part. I had to learn about Javascript multi-dimensional / nested arrays. My helpers were Google and these two explanations of this array type: http://jennifermadden.com/javascript/arraySimple2.html http://www.elated.com/articles/nested-arrays-in-javascript/ In the PHP portion mentioned in the previous post, first I changed the syntax to something I prefer working with (using single quotes instead of quotes), then realizing JavaScript was using this data in the form, I formatted this data into a JavaScript array... while($nt=mysql_fetch_array($q)){ $str=$str.'new Array("'.$nt[cust_name].'","'.$nt[arrayvaluefromMYSQL_2].'"),'; } Hopefully this will help someone out!
  2. where it says in HTML <textarea name="textarea" id="comment" cols="45" rows="5"></textarea> try changing that to <textarea name="comment" id="comment" cols="45" rows="5"></textarea>
  3. Found a great Ajax file uploader... http://phpfileuploader.com/ Anyone know a free alternative that can upload many images at once? I also found http://jupload.sourceforge.net/ which seems really good, but it's written in Java - I'd much rather people not need to "accept to trust" just to upload a file. Plus it doesn't offer file preview and when uploading images, that's practically a must. Multiple file uploader recommendation anyone?
  4. I figured it out. I just wanted to let everyone know so no one replies. I'll post the solution here for anyone interested and mark as solved later.
  5. When I've taken the time to think out a good way to ask a question, sometimes I find the answer and those questions become rhetorical. I like it. I assume this happens to many of us. I'm not saying I ask all of my questions in a good way, but most of the time I try to. It shows better respect for those who may help, the answers are usually better, and sometimes I get a better understanding of the problem when writing it out. Just sharing a way this forum has helped me out, even when I didn't actually "submit" a post.
  6. Here's the JS code: <script type="text/javascript"> function AjaxFunction(cust_id) { var httpxml; try { // Firefox, Opera 8.0+, Safari httpxml=new XMLHttpRequest(); } catch (e) { // Internet Explorer try { httpxml=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { httpxml=new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { alert("Your browser does not support AJAX!"); return false; } } } function stateck() { if(httpxml.readyState==4) { var myarray=eval(httpxml.responseText); // Before adding new we must remove previously loaded elements for(j=document.testform.subcat.options.length-1;j>=0;j--) { document.testform.subcat.remove(j); } for (i=0;i<myarray.length;i++) { var optn = document.createElement("OPTION"); optn.text = myarray[i]; optn.value = myarray[i]; document.testform.subcat.options.add(optn); } } } var url="dd.php"; url=url+"?cust_id="+cust_id; url=url+"&sid="+Math.random(); httpxml.onreadystatechange=stateck; httpxml.open("GET",url,true); httpxml.send(null); } </script> And I know what I need to modify is this section so that the optn.value will be different: var optn = document.createElement("OPTION"); optn.text = myarray[i]; optn.value = myarray[i]; document.testform.subcat.options.add(optn); The Javascript code pulls data from this php code: $q=mysql_query("select * from Customers where cust_type='$cust_id'"); echo mysql_error(); $myarray=array(); $str=""; while($nt=mysql_fetch_array($q)){ $str=$str . "\"$nt[cust_name]\"".","; } $str=substr($str,0,(strLen($str)-1)); // Removing the last char , from the string echo "new Array($str)"; I'm pretty sure what I need to modify is the while portion, but I'm not sure how to do it. Where it says $nt[cust_name] it also needs to have the second value needed something like $nt[cust_number] Anyone have any advice on this issue? Thank you very much and happy Valentines day! This code originated from: http://www.plus2net.com/php_tutorial/php_drop_down_list.php
  7. Thank you all for helping! NRG, I used your solution with the backslash. I figured it was something small that made it return a blank result, but I didn't know what it was. In the mean time, I wrote another method using str_ireplace for case insensitivity. $image = "4430 JoZlkA11215.jPg"; $numbers = array ('0','1','2','3','4','5','6','7','8','9','.JPG','.JPeG'); echo str_ireplace($numbers, '', $image).'<br />'; $string = '1051 JoZlkA11215.JpEg'; preg_match('#\d{4}\s+([^\d]+)\d+#', $string, $text); echo $text[1]; // JoZlkA I didn't mention that it would have .jpg (in up/lower case or jpeg), but I didn't think I would have to if it was coded in the manner you did; If I'm hypothesizing its operation properly, it says isolate from start of numbers to end of spaces, then from start of numbers to end of string. Is that right? Anyhow, I think your solution is better than mine (I think it's faster - I may test it when I get home, but in the mean time I'll be using your method). I also wanted to post mine here just to show a different way of doing it for others. Thank you again!
  8. select letters inbetween space and numbers I have a serious of forum entries that which need to isolate some info from... They all have this data Four Numbers, Spaces, Text, Numbers E.g. 1051 JoZlkA11215 Anyone know how to isolate that JoZlkA? Or can give me some direction? Thank you very much!!!!!!!!
  9. I do I get the IMGS seperated and indiviudally useable out of a comma delimited row? My row looks like this: ID | NAME | IMGS 33 | Joey | 532.jpg,536.jpg,537.jpg,538.jpg,539.jpg,540.jpg I've had help with a similar issue before, but I just don't get the arrays yet. (Been working on this issue for 2 days). Thank you so much!!!
  10. I know there are some "Hot or Not" scripts out there. Some pay and some free. I'd try searching for "hot or not" though, because it sounds like that's what you want.
  11. If it's on your main domain I think this will work RewriteBase / RewriteRule ^view_project.jsp?project=(.*)$ view_project.php5?project=$1 [R=301,L] If it's not in your main domain, you'll have to add your domain in there somewhere.
  12. I tried it and you were right that it didn't change anything. Funny... I just realized a new appreciation for error messages. lol. I'll keep researching and if I find anything I'll post the answer I find here. If you think of anything please let me know. Thank you for looking into this already.
  13. I'm sorry, I'm trying to redirect all urls like this example.com/a/Arts/?req=read&article_title=MonaLisa to example.com/a/Arts/MonaLisa.html but i need it to be it to redirect other categories too... example.com/a/News/?req=read&article_title=OsamaVSObamaBoxingMatch to example.com/a/News/OsamaVSObamaBoxingMatch.html Thank you for your response!
  14. Hello! I've been working on this .htaccess file for two days, unfortunately. Options +Indexes Options +FollowSymlinks RewriteEngine On RewriteBase / RewriteRule ^a/(.*)/?req=read&article_title=(.*)$ /a/$1/$2.html [R] RewriteRule ^cgi-bin/$ http://example.com/ [R] RewriteRule ^cgi-sys/scgiwrap/$ http://example.com/ [R] RewriteRule ^a/(.*)/(.*)\.html$ /a/$1/?req=go&name=$2 ErrorDocument 404 http://example.com/notfound.php I've got it all figured out except the redirecting in red. It's been a major pain in the butt. Nothing happens at all with that red code in there! I have one piece of code (in blue) to rewrite the url, and another (red) to redirect the old version to the new version. Do you have any idea what I'm doing wrong? Thank you so much!
  15. lol i was just joking about it coming back... maybe the mullet is coming back stronger than i anticipated.
  16. Please correct me if I'm wrong, but it seems that tables will never cease being supported and are currently interpreted correctly and supported more than CSS (think mobile devices!). I say they'll never ceased being supported because that would render a lot of information presentation across the internet useless... While it may not be the latest style (pun intended) of presentation, it's still a major backbone. Take a look at this page, even it uses tables! Some things just need the solidity of tables IMO... I guess that's why major companies like Yahoo and Google haven't switched completely to CSS yet. It's also like a mullet, it's coming back!!! My code and my hair may look like hell, but it's functionality I seek. I've probably been missing out a lot without exploring CSS completely, but I've never been motivated working with something that works and when testing out CSS having cross-OS and cross-browser issues issues. I don't even own an iPhone or a cellphone with a browser in general, so I'd just be guessing and crossing my fingers that my CSS would be interpreted right. Oh well! lol I don't want to argue about it anyway, the bottom line is I was just providing an another solution. You can do it without divs too... <center> <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="87%"> <tr> <td width="100%">CONTENT</td> </tr> </table> </center> <!--OR--> <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="87%" align="center"> <tr> <td width="100%">CONTENT</td> </tr> </table>
  17. Hello Corbin! Thank you so much! Your code worked great for me... I just modified it a bit to make it work for my necessary application... I'm posting the modifications here for future users... I wrote something in bold at the bottom for you... At first I was getting an error: Warning: preg_replace() [function.preg-replace]: Unknown modifier '?' in Apparently the second question mark didn't need to be escaped... I also took out the "foreach" and accompanying squiggly brackets since I didn't need the $str to be an array... My final code was preg_replace( '/<img.*src="(.*?)".*?>/', '<a href="\1">Image file</a>', $str ); No one ever says hi because we take the nature of computers (unresponsive without input, and responses are preprogrammed) and wrongfully apply them to people on the net, who's computer input is often the most we see of them anyway, making even their responses seem less human than computer. Currently, without AI, saying hi to a computer is like saying hi to a stone. You rarely get a response you don't expect... Luckily for us though, thanks to things like your signature "Why doesn't anyone ever say hi, hey, or whad up world?" we are reminded of our chance to be friendly, and that it should at least occasionally be acted on ^_~
  18. I'm old school, but this can easily be done without CSS... Put all of your content inside a table and just center the table... <div align="center"> <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="80%"> <tr> <td width="100%"> <!--Start content--> HERES ALL YOUR CONTENT! ALL NEATLY DISPLAYED IN THE CENTER OF PAGE! <!--End content--> </td> </tr> </table> </div> Play with the "width" attribute to see how you want it... (don't forget to check it in multiple resolutions (control panel>display>resolution...) - pretty much all browsers interpret the ol' school table stuff the same, but you can test it in different browsers too)
  19. I want to stop images from using bandwidth unless someone specifically decides to view the image... Whether it's png,PNG,svg,SVG,jpg,JPG,JPEG,jpeg,gif, or GIF... While <img src=""> is always there, border, alt, and slash (/) are sometimes there. E.g. <?php $content = 'So the most Christian image on the internet ever is <img src="http://chexed.com/images/rsymbols/Cross.gif" border="0" alt="Cross" /> but don't forget my logo <img src="http://chexed.com/images/logos/243x88.jpg"> which is also pretty cool, though not necessarily Christian. //USE REGEX TO GET THE FOLLOWING OUTPUT preg_replace(SOMETHINGhere,<a href="\0">Click to view image</a>, $content) //pretty sure I have everything right except the SOMETHINGhere ?> Output: So the most Christian image on the internet ever is <a href="http://chexed.com/images/rsymbols/Cross.gif">Click to view image</a> but don't forget about my logo <a href="http://chexed.com/images/logos/243x88.jpg">Click to view image</a> which is also pretty cool, though not necessarily Christian. I've been working on and off on this for days! I've read enough about regex to know it's possible, just haven't found the right article/page to teach me the syntax in its entirety except one for JavaScript regex, which I don't know if it's the same or not... Any help will be very much appreciated!
  20. It may help to know how you want it incorporated into your script... You can write it in pseudocode... eg; <?php //Display the row of data $output .= "<tr bgcolor=\"$bgcolor\">\n"; $output .= "<td>".$row['Receiver']."</td>\n"; $output .= "<td>".$row['Amount']."</td>\n"; $output .= "<td>".date('d/F/Y h:i:s a', strtotime($row['Date']))."</td>\n"; $output .= "<td>".$TodayOrYesterday."</td>\n"; //how do I find out what $TodayOrYesterday is? $output .= "</tr>\n"; ?> I'm just not really sure how you want it incorporated without an example... But, if that's the case, you can use the previously suggested code by the fellows before me, and just change the "ECHO"s to put it straight into the $output var... eg; <?php //Display the row of data $output .= "<tr bgcolor=\"$bgcolor\">\n"; $output .= "<td>".$row['Receiver']."</td>\n"; $output .= "<td>".$row['Amount']."</td>\n"; $date_show = date('d/F/Y h:i:s a', strtotime($row['Date'])); $date_compare = date('d/F/Y h:i:s a', strtotime($row['Date'])); $date_today = date("m.d.Y"); $date_yesterday = date("m.d.Y", strtotime("-1 day")); if ($date_compare == $date_today) { $output .= "<td>Today</td>\n"; // echo 'Today'; }else if ($date_compare == $date_yesterday) { $output .= "<td>Yesterday</td>\n"; // echo 'Yesterday'; }else { $output .= "<td>".$date_show."</td>\n"; }; $output .= "</tr>\n"; ?> Psst. I just figured out how to make the code color-coded... No pun intended... Include <?php AND ?> !
  21. Thank you all very much! I wanted to post the rest of the code here I used so it my help someone else in the future. Sorry it took so long, because I wanted to make sure I had a working example of the code as well. I ended up using the code from Barand except for the last part I added this: arsort($results); foreach($results as $word=>$count) { //limit to most used if ($count>= 5){ echo 'The number of '.$word.' is '.$count.'<br>'; } } I used arsort to get some order in the mix and created an IF statement to limit the results to the highest numbers. I have a finished tag section of my site, where I used comma delimited "keywords" as tags.
  22. I want to count each unique entry from every row within in one comma delimited column, while adding duplicate entries to the total count for the uniques... I hope I'm explaining this right. E.g. Column_A ROW1: What, Hello, Hi ROW2: Hello, Hey, Hi ROW2: Hello, Wazza, Hello echo totals: What = 1, Hello = 3, Hi = 2 etc... How do I extract and count column A's data and echo it? I've been working on this problem on and off for months. I will really appreciate the help on this puppy!
  23. any more ideas why the script <?php mkdir($_SERVER['DOCUMENT_ROOT'].'/testfolder'); ?> would not create a folder?
  24. I'd try it in a different browser, (try refreshing the page first, though you've probably done that 30 times) Also, try putting it into a variable first just to see what happens... i.e. $echoiticommandyou = "<img src=\"checked.gif\"/>"; echo $echoiticommandyou;
  25. $rhostget = str_replace("google.com/search?","",$HTTP_REFERER); //returns q=web+site+designs&hl=en&rls=GGLR,GGLR:2005-41,GGLR:en&start=90&sa=N $rhostget = str_replace("+","",$rhostget); //returns q=websitedesigns&hl=en&rls=GGLR,GGLR:2005-41,GGLR:en&start=90&sa=N Strip out whatever you like... using that.... Another option (which I don't know the syntax for or I'd post it for you) is to store the HTTP_REFERER in an array, and select characters only to a certain number or "until" a "&" is come across
×
×
  • 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.