Jump to content

Muddy_Funster

Members
  • Posts

    3,372
  • Joined

  • Last visited

  • Days Won

    18

Everything posted by Muddy_Funster

  1. nice and easy, assuming you're using PHP: $form1 = $_POST['form1']; $form2 = $_POST['form2']; $form3 = $_POST['form3']; $calcResult = $form2 * $form3; $sql = "INSERT INTO yourTable (fieldName1, fieldName2) VALUES ('$form1', '$form2')"; $result = mysql_query($sql) or die (mysql_error()); you will obviously need to taylor for your own variables but that's the general idea.
  2. in theory yes, once you have loaded the file_get_contents() into a variable it's effectivly just another sring as far as PHP is concerned (all be it a fairly large one in most cases), so all string functions will work on it.
  3. right, so effectivly i need to push the data out of the AJAX function rather than pulling in from the JS one? So I need to edit the JS to accept the innerHTML push from the AJAX in the div constructor rather than passing the data to the string variable as I was trying to do? Or am I as confused as I feel right now? lol
  4. I don't think I even have jQuery (unless it's built into something else and I didn't know it). I was using the writeOut in an atempt to force the execution of the AJAX at the right time (so that the results of the AJAX lookup would be there for the population of the innerHTML when the JS was trying to write it. The problem is I want the output from the data.php to be run through a cut&paste horizonatal scrolling ticker. the code is this: <html> <head> <title>News Scroller Horizontal v2.2</title> <!-- STEP I: Goes between <HEAD> & </HEAD> tags You may keep it, change or ignore it! Or linking to an External Style Sheet: <LINK REL=StyleSheet HREF="yourstyle.css"> without other style tags --> <style type="text/css"> A { text-decoration:none;} A:link {color:blue;} A:visited{color: blue;} A:hover {color: red;background-color:#66ffff;} .tab {font-size:12px;font-family:Arial,Helvetica;color:navy;} .tabb {font-size:14px; font-family:Arial,Helvetica;} </style> <!-- STEP II: Goes between <HEAD> & </HEAD> tags Or linking to an External js file: <script language="javascript" src="yourfile.js"></script> without other script tags --> <SCRIPT LANGUAGE="JavaScript"> /*********************************** * http://javascripts.vbarsan.com/ * This notice may not be removed ***********************************/ //-- Begin Scroller's Parameters and message --> //scroller width: change to your own; var wwidth=450; //scroller height: change to your own; var wheight=20; //background color: change to your own; var wbcolor="#ccffcc"; //scroller's speed: change to your own; var sspeed=2; var restart=sspeed; var rspeed=sspeed; //text: change to your own wwholemessage='<nobr class=tab><b>News Scroller Horizontal v2.2 => '+ '<a class=tabb href="http://javascripts.vbarsan.com">'+ 'Vertical Scroller JavaScript 7.0 + Horizontal Scroller JavaScript 7.0 + Typewriter Scroller JavaScript 5.0</a> <= Text Scroller Horizontal v2.2</b></nobr>'; //Or you may do a slide show running left any number of images too! //Preload is recommended (no downloading check) - otherwise you may skip this: //preload1 = new Image(); //preload1.src = "http://..."; //preload2 = new Image(); //preload2.src = "http://..."; //preload3 = new Image(); //preload3.src = "http://..."; // ... //if no preloading, replace below '+ preload... +' with the actual Images path "..." //wwholemessage='<nobr><img src='+preload1.src+' width=... height=... alt="...">'+ //'<img src='+preload2.src+' width=... height=... alt="...">'+ //'<img src='+preload3.src+' width=... height=... alt="...">'+ //'<img ... ></nobr>'; //-- end Parameters and message--> //-- begin: Scroller's Algorithm --> var sizeupw=0;var operbr=navigator.userAgent.toLowerCase().indexOf('opera');if(operbr==-1&&navigator.product&&navigator.product=="Gecko"){var agt = navigator.userAgent.toLowerCase();var rvStart = agt.indexOf('rv:');var rvEnd = agt.indexOf(')', rvStart);var check15 = agt.substring(rvStart+3, rvEnd);if(parseFloat(check15)>=1. operbr=0;}if (navigator.appVersion.indexOf("Mac")!=-1)operbr=0; function goup(){if(sspeed!=rspeed*{sspeed=sspeed*2;restart=sspeed;}} function godown(){if(sspeed>rspeed){sspeed=sspeed/2;restart=sspeed;}} function startw(){if(document.getElementById)ns6marqueew(document.getElementById('wslider'));else if(document.all) iemarqueew(wslider);else if(document.layers)ns4marqueew(document.wslider1.document.wslider2);}function iemarqueew(whichdiv){iedivw=eval(whichdiv);iedivw.style.pixelLeft=wwidth+"px";iedivw.innerHTML='<nobr>'+wwholemessage+'</nobr>';sizeupw=iedivw.offsetWidth;ieslidew();}function ieslidew(){if(iedivw.style.pixelLeft>=sizeupw*(-1)){iedivw.style.pixelLeft-=sspeed+"px";setTimeout("ieslidew()",100);}else{iedivw.style.pixelLeft=wwidth+"px";ieslidew();}}function ns4marqueew(whichlayer){ns4layerw=eval(whichlayer);ns4layerw.left=wwidth;ns4layerw.document.write('<nobr>'+wwholemessage+'</nobr>');ns4layerw.document.close();sizeupw=ns4layerw.document.width;ns4slidew();}function ns4slidew(){if(ns4layerw.left>=sizeupw*(-1)){ns4layerw.left-=sspeed;setTimeout("ns4slidew()",100);}else{ns4layerw.left=wwidth;ns4slidew();}}function ns6marqueew(whichdiv){ns6divw=eval(whichdiv);ns6divw.style.left=wwidth+"px";ns6divw.innerHTML='<nobr>'+wwholemessage+'</nobr>';sizeupw=ns6divw.offsetWidth;if(operbr!=-1){document.getElementById('operaslider').innerHTML='<nobr>'+wwholemessage+'</nobr>';sizeupw=document.getElementById('operaslider').offsetWidth;}ns6slidew();}function ns6slidew(){if(parseInt(ns6divw.style.left)>=sizeupw*(-1)){ns6divw.style.left=parseInt(ns6divw.style.left)-sspeed+"px";setTimeout("ns6slidew()",100);}else{ns6divw.style.left=wwidth+"px";ns6slidew();}} //-- end Algorithm --> </script> <!-- End of Script between <head> & </head> tags--> </head> <!-- STEP III: Make sure startw() is loaded. If you have in your page multiple "onload" events, place them all using one onload event handler within BODY TAG, like this: onload="Funct1(); Funct2(); ...;" Or use this: function alltostart() { funct1(); funct2(); ... } window.onload = alltostart; --> <body onload="startw();"> <!-- STEP IV: Goes between <BODY ... > & </BODY> tags begin: body code --> <!-- You may remove first cell below (<td> ... </td>) to get rid of Speed-change --> <script language="JavaScript">document.write('<table align="center" border="2"><tr><td bgcolor="#ffffcc"><div class=tabc><b><u><a class=tabb href="#" onMouseOver="goup();">UP </a></u>-<u><a href="#" class=tabb onMouseOver="godown();"> DN</a></u></b></div></td><td width='+wwidth+'px>');if(document.getElementById || document.all){document.write('<span style="width:'+wwidth+'px;"><div style="position:relative;overflow:hidden;width:'+wwidth+'px;height:'+wheight+'px;clip:rect(0 '+wwidth+'px '+wheight+'px 0);background-color:'+wbcolor+';" onMouseover="sspeed=0;" onMouseout="sspeed=restart">');if(operbr!=-1)document.write('<div id="operaslider" style="position:absolute;visibility:hidden;"></div>');document.write('<div id="wslider" style="position:absolute;height:'+wheight+'px;"></div></div></span>')}</script> <ilayer width=&{wwidth}; height=&{wheight}; name="wslider1" bgcolor=&{wbcolor};><layer name="wslider2" width=&{wwidth}; height=&{wheight}; onMouseover="sspeed=0;" onMouseout="sspeed=restart"></layer></ilayer></td></tr></table> <!-- end of code between BODY TAGS --> </body></html> as you can see the wwholemessage variable is being hard set at the moment, and I need it to come from a db table using the data.php to load it. I'm really not having fun with this any more
  5. oooookkkkk...... I did mention that my knwledge of JS is right up there with what a fish knows about climbing trees right? do I just remove the success: form the line or is there some other function call I should be using?
  6. you could try SELECT DISTINCT category_name, catagory_id FROM db WHERE parent_id IN (0, (SELECT catagory_id FROM db as dbTemp WHERE parent_id = 0))
  7. sadly not, I had played with the variable names already, using var at start and not using var at start, that's why it wasn't consistant at this point. I changed it anyway, still returning Undefined. Thanks for the reply though, keep em coming
  8. in your index.php page for your subdomain put the following code: <?php header('Location: www.maplewebdesign.co.uk/index.php?page=blog'); ?>
  9. hi guys. Having a spot of bother getting my head around this (mainly because I know pretty much bugger all about JS) But I'm trying to take an AJAX xmlResponseText and pass it out to a cariable in the JS. I know tha tthe async nature of AJAX makes this not as strait forward as I would like, and I have been hacking at this bit of code for a while now. I just want to be able to call the response text as a string variable for a bit of JS in the page body to apply some styling to. here's the mess I have just now: var xmlHttp; try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); } catch (e) { // Internet Explorer try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { alert("Your browser does not support AJAX!"); } } } function getData(){ xmlHttp.open("GET", "data.php", true); xmlHttp.send(null); xmlHttp.onreadystatechange = function(){ if(xmlHttp.readyState == 4){ dateOut = xmlHttp.responseText; success: function writeOut(dataOut){ return dataOut; }; } }; }; and am trying to call it with myVar = getData(); ... ... document.getElementByID("dispDiv").innerHTML = myVar; All I get to display is "Undefined" so I'm clearly screwing this up somewhere along the line, and I just know it's a stupid simple little mistake but I need someone to point it out for me.
  10. I'm sorry....whats a "text input thingy"?
  11. I gotta ask....why do you need a database for that? surely you can echo a file_get_contents within your div tags?
  12. you can only apply a fulltext index to a field that can contain text....would have thought that was fairly self evident . Moreove your should only be applying a fulltext index to long string fields that you are going to want to part-search, fields like name and type generaly gain no benefit from fultext indexing. I suggest you research a little before "playing" with indexing.
  13. my bad, should read more carefully. here this looks like what you want, I lifted this directly from the php manual :
  14. ksort($chunkedValues);
  15. Or if you only want to show a different word without changing the data in the table you could use this, handy for masking the start of sensetive information, such as card no's and the like SELECT REPLACE((SELECT `text` FROM table where left(`text`, Length('WordToReplace')) = 'WordToReplace'), 'WordToReplace', 'NewWord')
  16. I wonder if it's anything to do with the free_result() (long shot, but as you say, on the surface it looks fine) try commenting out the lines that use the free_result() and see if it makes a difference
  17. this really isn't the place for that question
  18. no semicolon after your last curly brace, but other than that syntax looks ok. Normaly I'd say you don't need a mysql_real_escape_string on a radiobutton input, but as your using JS you're as well keeping it in.
  19. I'm sorry - what's this gotta do with PHP?
  20. Sometimes you may want to have things change in your overall layout depending on what page you are on. For example using menus which expand; you may want to expand the current page item. ...you know what, theres clearly no point, it's just not getting through. @Lingo, glad it all worked out for you, now quick: lets all run away beofre we start that "better ways of doing stuff" thing that CPD thought of
  21. AGAIN - Why not code it into the actual page? if you are looking up a page through include you have access to any variable on either page and can as such echo determinant infomation. Job done. PS, unless they picked the wrong sex in the profile page - the OP would be a she, not a he.
  22. surely there is a fundemental flaw in wanting to base a new site on one that is always down... quick question though, if I use your new site using cookies, and I delete my cookies after every logoff, do I then also loose access to my files?
  23. if it's just rendering HTML, can't you just apply a style to it?
  24. I don't understand why you are doing that, why not just code the info into the actual page you are on?
×
×
  • 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.