gurroa
-
Posts
87 -
Joined
-
Last visited
Never
Posts posted by gurroa
-
-
// this function sort double array by given key name function SortArrayByValue($ar, $keyname, $desc = false) { if (!is_array($ar) || empty($keyname)) return $ar; $arsort = array(); reset($ar); while(list($key, $rad) = each($ar)) { $val = $rad[$keyname]; $v = 1; while(isset($arsort[$val])) $val = $rad[$keyname].' '.$v++; $arsort[$val] = $key; } if ($desc) krsort($arsort); else ksort($arsort); reset($arsort); $retar = array(); while(list(,$key) = each($arsort)) $retar[$key] = $ar[$key]; return $retar; } $arevents = array(); while($row = mysql_fetch_array($result)) { $startdays = array($row['Startdate1'], $row['Startdate2'], $row['Startdate3']); if (!empty($startdays[0])) { $row['Startdate'] = $startdays[0]; $row['Sortway'] = $row['Startdate'].' '.$row['Time']; $arevents[] = $row; } if (!empty($startdays[1])) { $row['Startdate'] = $startdays[1]; $row['Sortway'] = $row['Startdate'].' '.$row['Time']; $arevents[] = $row; } if (!empty($startdays[2])) { $row['Startdate'] = $startdays[2]; $row['Sortway'] = $row['Startdate'].' '.$row['Time']; $arevents[] = $row; } } if (count($arevents) > 0) $arevents = SortArrayByValue($arevents, 'Sortway', false); //listevents reset($arevents); while(list(,$row) = each($arevents)) echo $row['Startdate'].' '.$row['Title'].'<br />';
-
See php.gurroa.cz/test/simplecalc.html.
You still have to use period in math operations.
And also try to test result if somethings doesn't work,
like what result are you getting from this function
document.profit_form.profit_display.value.indexOf(',')
-
Comparing is done via == sign not =.
function validatei_agree(fld) { if (fld.checked == false) { // if (!fld.checked) delete fld; return "You must agree to the Terms and Conditions"; } delete fld; return ""; }
-
I would use stripos and substr.
As long as the data are stored in the simple table...
$contentofsite = '<html.....</html>'; function GetCont($search, $htmldata) { $_table_start = ($i = stripos($htmldata, '<td><b>'.$search)) !== false ? stripos($htmldata, '<table', $i-100) : -1; if ($_table_start > 0) return ($i = stripos($htmldata, '</table>', $i+6)) !== false ? substr($htmldata, $_table_start, $i-$_table_start+ : 'Not found'; return 'Not found'; } echo GetCont('Earnings Est', $contentofsite);
-
If you don't want to use javascript,
you can use only two frames and the second one containing <iframe>.
Than you just submit your form fromt the first one into the second frame.
//file1.html <frameset rows="120,*"> <frame name="formframe" src="form.htm"> <frame name="resultsframe" src="res.php"> </frameset> //form.htm <form target="resframe" method="post"> <input type="submit" value="send"> </form> //res.php <body> <iframe src="links.html" style="position: absolute; right: 0; height: 100%; width: 200px;..whatever.."></iframe> <?php /* form results... */ ?> </body>
If you don't want to use <iframe> you can achieve similar results by using two framesets... (but you will have to resend form content through the second frameset).
-
<img src="mouse.gif" onmouseover="document.getElementById('ImageToChange').src='images/nav/2-on.gif';" onmouseout="document.getElementById('ImageToChange').src='images/nav/2.gif';" ><br /> ... <img src="images/nav/2.gif" id="ImageToChange">
-
Just prepare form with hidden fields and submit it just after opening new window.
You just have to set the same target as is the new window's name.
<html> <script> function OpenNewWindow() { window.open('about:blank', 'NewWindow', '...'); } </script> <body> <form name="MyHiddenForm" method="post" action="test3.php" target="NewWindow"> <input type="hidden" name="var1" value="val..."> <input type="hidden" name="var2" value="val..."> </form> <button type="button" onclick="OpenNewWindow(); document.MyHiddenForm.submit();">Open new window</button> </body> </html>
-
Try it this way. <?php // php code is here require "config.php"; $query = mysql_query("SELECT COUNT(page_title) AS cnt FROM pages") or die ("Could not query because: ".mysql_error()); $row = mysql_fetch_array($query); $count = isset($row['cnt']) ? $row['cnt'] : 0; if ($count > 707185109) { ?> for (var i = 707185109; i < <?php echo $count; ?>; ++i) document.write(i); delete i; <? } ?>
-
<html> <script>var i = 0;</script> <body> <form name="Things"> <textarea onClick="if(i == 0){document.Things.ThingBest.value='';++i;}" name="ThingBest">Test</textarea> </form> </body> </html>
and second if you can bet on not using z-index ever
onClick="if(!document.Things.ThingBest.zIndex){document.Things.ThingBest.value='';document.Things.ThingBest.style.zIndex=1;}"
-
function ReturnRandomFromArray(&$arr) { $randar = array(); reset($arr); while(list(,$hod)=each($arr)) $randar[] = $hod; $randar = array_values($randar); $c = count($randar); if ($c > 1) { --$c; $r = rand(0,$c); while(empty($randar[$r])) $r = rand(0,$c); return $randar[$r]; } elseif ($c == 1) return $randar[0]; else return ''; } // you will probably fill this array from your database $ardat = array( 'tile unique id', 'tile unique id'....); $armap = array(); for ($x = 0; $x < 16; ++$x) { $xx = $x * 16; for ($y = 0; $y < 16; ++$y) $armap[$xx + $y] = ReturnRandomFromArray($ardat); }
-
If you send form using the get method you should not add variables into the action url.
Try moving variables from action into <input type="hidden" type fields.
echo "</table></form><form method='get' action='update.php'>"; echo '<input type="hidden" name="c" value="'.$c.'">'; echo '<input type="hidden" name="r" value="'.$r.'">'; echo '<input type="hidden" name="t" value="'.$t.'">'; echo $c." ".$r."<input type=submit name=update value=Update /></form><br />";
Warning appeard because php converts empty variable into 0 (if you deal with such variable in any math operation).
[SOLVED] Help with counting same numbers in a string.
in PHP Coding Help
Posted
http://www.php.net/manual/en/function.substr-count.php