lindm
Members-
Posts
199 -
Joined
-
Last visited
Never
Everything posted by lindm
-
Well hope I know what an array is...stored values... What I am looking for is to reformat the whole array in one go. Old approach to change number format for single value: number_format($arrayvalue["xxx"], 0, ',', ' '); Say array is stored in $array. Trying the approach number_format($array, 0, ',', ' '); but no go.
-
Array is formatted without any whitespace.
-
Is it possible to number format an array? Say I have an array in the format 99999999. I want to add thousand delimiter with a space like this function: number_format($string, 0, ',', ' '); Possible?
-
Alright. Thanks for all help!
-
Having some problems. The script1 has this part to verify if the login is ok: session_start(); if(!isset($_SESSION['username'])){ echo 'No access'; exit(); } As far as I can tell the file_get_contents() doesn't take into account SESSIONS. Is this correct?
-
Alright. What if the script on server 1 is protected by a userid and password? (Stored in $_SESSION['username'] and $_SESSION['password'])
-
I have php scripting on two web servers: On server 1 I have a php script that generates html code, stored in a variable. I want to pass this variable to another php script found on server 2. What is the best way to do this?
-
This seems to work $xml = simplexml_load_string($string); foreach ($xml->children('xxxxx')->Inledning as $test) { if ((string)$test->attributes()->contextRef == 'DURpy') echo $test; }
-
Now I am really close: $string=<<<XML <?xml version="1.0" encoding="UTF-8"?> <xbrli xmlns:se-gen-base="xxxxx" > <se-gen-base:Inledning contextRef="DURcy">10000</se-gen-base:Inledning> <se-gen-base:Inledning contextRef="DURpy">20000</se-gen-base:Inledning> </xbrli> XML; $xml = simplexml_load_string($string); foreach ($xml->children('xxxxx')->Inledning as $test) { if ((string)$test['contextRef'] == 'DURcy') echo $test; } Why doesn't this return 10000?
-
Just new to XML parsing but can't seem to get my xml file to work. Please see code below. Two questions: 1. Is the colon a problem? 2. How can I print only the tag where contextRef="DURcy" <?php $string='<?xml version="1.0" encoding="UTF-8"?> <xbrli:xbrl> <se-gen-base:Inledning contextRef="DURcy">10000</se-gen-base:Inledning> <se-gen-base:Inledning contextRef="DURpy">20000</se-gen-base:Inledning> </xbrli:xbrl> ' ; $xml = simplexml_load_string($string); print header("Content-type: text/plain"); print_r($xml->xpath("/xbrli:xbrl/se-gen-base:Inledning")); ?>
-
I have a price of code that transforms a string as follows: 1. Removes blanks 2. Rounds the number 3. Adds blanks again I get a strange output when trying to apply the code the negative numbers. When a user for instance enters - 1 000 000 or -10 000 000 into the outcome is -100 000. Code: function rrab($string) {$string2 = str_replace(' ', '', $string); $string3 = round($string2); $string4 = number_format($string3, 0, ',', ' '); return $string4;}
-
I am looking for a way to cover the row of a html table with a colour. Not a background colour bur rather a background colour that covers all the contents of the row or cell, call it a frontground... Possible?
-
Alright json_encode seems to help As fairly new to php, is this ok scripting to strip the array to a string easy readable by the javascript? $result='{"field1":"5","field2":"6"}'; //array from query $stripresult=str_replace('"', '', $result); $stripresult2=str_replace('{', '', $stripresult); $stripresult3=str_replace('}', '', $stripresult2); echo $stripresult3; My spontaneuous guess is what if a field contains a " ??
-
Alright so next problem regarding the script above. The array from a mysql query is in the format: Array ( [0] => Value [field] => Value [field2] etc) Is the best way to change the javascripts way to read the array or change the array in php to suit the javascripts way to read the array?
-
Works now! Will fiddle a bit more with mysql etc. Is there a simple script to submit a form in the background?
-
Alright getting off to a beginning here. Trying to make your code snippet work with existing simple ajax code. No go so far. HTML <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> <title>Untitled Document</title> <script language="javascript" type="text/javascript"> <!-- //Browser Support Code function ajaxRequest(){ var activexmodes=["Msxml2.XMLHTTP", "Microsoft.XMLHTTP"] //activeX versions to check for in IE if (window.ActiveXObject){ //Test for support for ActiveXObject in IE first (as XMLHttpRequest in IE7 is broken) for (var i=0; i<activexmodes.length; i++){ try{ return new ActiveXObject(activexmodes[i]) } catch(e){ //suppress error } } } else if (window.XMLHttpRequest) // if Mozilla, Safari etc return new XMLHttpRequest() else return false } //--> </script> </head> <body> <script language="javascript" type="text/javascript"> function ajaxpost(){ var X=new ajaxRequest(); X.open('get',ajax.php); X.onreadystatechange=function(){ if(X.readyState==4 && X.responseText){ var allRows=X.responseText.split("~"); for(var i=0; i<allRows.length; i++){ var allFields=allRows[i].split("|"); for(var j=0; j<allFields.length; j++){ var oneField=allFields[j].split("^"); document.getElementById(oneField[0]+'Tag').innerHTML+=oneField[1]; } } } }; X.send(null); } //--> </script> <form id="form1" name="form1" method="post" action=""> <input type="text" name="1" id="1" /> <br /> <input type="text" name="2" id="2" /> <input type="button" name="button" id="button" value="Load" onClick="ajaxpost();" /> </form> <br /> </body> </html> PHP <?php echo '1^1|2^2~'; ?>
-
I learn a lot from code examples on the web. Any good sources for what I am looking for?
-
Alright got it. Been looking around but seem only to find simple ajax routines where the contents of one div is updated. What I am looking for is: Htmlpage: 20 form elements Mysql-database: 20 fields corresponding to the form elements Php-script: gets data from mysql User clicks update button in htmlpage. Ajax gets data from via php-script from mysql-database and updates all form fields on the htmlpage. Can anyone point me to an example?
-
Looking for two simple (hopefully) ajax scripts that: Script 1: Submits ALL form elements found on a html page in the background and updates a mysql-database with the data. Script 2: Retrieves ALL fields from the mysql-database and updates the corresponding form elements (same name as mysql field) on the html page. Been looking around but haven't found any spot on solutions. Anyone seen this somewhere?
-
The code below shows perfect in firefox 3 and safari 3 on my mac but in Explorer and Firefox 3 (!) on windows the iframe is not 100% tall. Pulling my hair for the last couple of days. Any help to get clean code is appreciated, or other solution as well. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> <title>e-revisor.se : Professionella webbaserade redovisningstjänster</title> <style type="text/css"> <!-- html, body, table{height:100%; } body{ margin:0; padding:0; overflow: hidden;/*No scroll*/ background: #2756A2 url(bilder/xbody_bg.png) repeat-x top center; } th, td, body { font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px; font-weight:normal; color: #FFFFFF; } #topmenu{ background-image: url(bilder/xtopmenu2.png); background-repeat: repeat-x; background-position:top; height:18px; width:100%; padding-top:2px } table td, tr{border:none; padding:0px; background-color:#FFFFFF; vertical-align:top;} --> </style> </head> <body> <table width="820px" border="0" cellspacing="0" cellpadding="0" align="center"> <tr> <td style="background-image:url(bilder/xleft.png); background-repeat:repeat-y;"><span style="background-image:url(bilder/xleft.png); background-repeat:repeat-y;"><img src="bilder/xlefttop.png" alt="" width="20" height="145" /></span></td> <td height="100%"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td> <div id="logo" style="height:75px;background-image:url(bilder/xtopmenu.png); background-repeat:no-repeat; text-align:right"> </div> <div id="topmenu"><a href="main.html" target="mainiframe">Hem</a> </div> </td> </tr> <tr height="100%"> <td> <div style="padding-left:10px;height:100%;"> <iframe name="mainiframe" id="mainiframe" frameborder="0" src="main.html" height="100%" width="770px"></iframe> </div> </td> </tr> </table> </td> <td style="background-image:url(bilder/xright.png); background-repeat:repeat-y;"><span style="background-image:url(bilder/xright.png); background-repeat:repeat-y;"><img src="bilder/xrighttop.png" alt="" width="20" height="145" /></span></td> </tr> </table> </body> </html>
-
I am combining a div setup with an iframe but the iframe gets cutoff corresponding to the height of the top menu. No clue to why. Please see code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> <title>Untitled Document</title> <style type="text/css"> <!-- html, body{height:100%; background: #2756A2 url(bilder/xbody_bg.png) repeat-x top center; } * html #container{ /*IE6 hack*/ height: 100%; width: 100%; } body{ margin:0; padding:0; overflow: hidden;/*No scroll*/ } #container { width: 820px; /*Width of main container*/ margin: 0 auto; /*Center container on page*/ height:100%; } #left { float: left; width: 20px; background-image:url(bilder/xleft.png); background-repeat:repeat-y; height:100%; } #middle { margin-left: 20px; margin-right: 20px; height:100%; background-color:#FFFFFF; } #logo { background-image:url(bilder/xtopmenu.png); background-repeat:no-repeat; height:65px; width:100%; text-align: right; vertical-align: bottom; } #main { height:100%; width:100%; padding:0px; } #right { float: right; width: 20px; background-image:url(bilder/xright.png); background-repeat:repeat-y; height:100%; } #topmenu{ background-image: url(bilder/xmenu.png); background-repeat: repeat-x; background-position: left top; width:780px; height:23px; padding: 2px; } .menu1{ font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px; font-weight:normal; color: #FFFFFF; vertical-align: bottom; padding: 6px; } .px10{ font-size:10px; } --> </style> </head> <body> <div id="container"> <div id="left"><img src="bilder/xlefttop.png" width="20" height="252"></div> <div id="right"><img src="bilder/xrighttop.png" width="20" height="252"></div> <div id="middle"> <div id="logo"> </div> <div id="topmenu"> </div> <div id="main"> <iframe height="100%" width="100%" src="http://www.dmi.dk" frameborder="0"></iframe> </div> </div> </div> </body> </html> Any ideas to why much appreciated. Tested on Safari 3 and Firefox 3
-
Got a small piece of code for a tooltip popup window: <a class="h" onmouseover="Tip(t17)" onmouseout="UnTip()">(?)</a> This snip occurs many times on the page with the variable t1 to t100. Is there a way to make the code smaller (save space)? I have been thinking of a few options: 1. Only using one event handler. Perhaps some type of onchange event... 2. Using css to handle the tooltip. Is it possible to call a javascript within css (hover: script(); or something...) Any help appreciated.
-
Seems to be correct. Thanks!
-
Trying to make the width of a form text input field exactly match the width of a table cell. Somehow Dreamweaver displays that the cell is forced to be 2 px wider. No matter what I try this doesn't disappear. Is this impossible? My test code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> <title>Untitled Document</title> <style type="text/css"> <!-- table td {padding:0px;margin:0px;} input {width:120px; border-width:0px; margin:0px; padding:0px;} </style> </head> <body> <table border="0" cellspacing="0" cellpadding="0"> <tr> <td width="120px"><input type="text" name="textfield" id="textfield"/></td> <td width="120px"> </td> <td width="120px"> </td> </tr> </table> </body> </html>
-
Reading different views on if both the id and name are necessary for a form element. What are your views? See http://bytes.com/forum/thread150126.html http://www.webmasterworld.com/forum21/6195.htm