-
Posts
5,717 -
Joined
-
Last visited
-
Days Won
6
Everything posted by Adam
-
For JS date: http://www.w3schools.com/jS/js_obj_date.asp Would appear you can use if...else if... else shorthand notations! If anyone else was wondering.. A
-
You mean better suited in the JS forum? Better off using a function: function defaultValSwitch(obj, default, e) { var val; if (e == 'onfocus') { val = (obj.value == default) ? '' : obj.value; } else { val = (obj.value == '') ? default : obj.value; } obj.value = val; return; } Then you'd call it like: <input name="customerRef" type="text" class="fields" id="customerRefField" onfocus="defaultValSwitch(this, 'i.e ITA001', event);" onblur="defaultValSwitch(this, 'i.e ITA001', event);" value="i.e ITA001" size="25" /> I haven't tested this but it should work - just going off memory! EDIT: I'd put if == 'onclick' instead of 'onfocus' .. A
-
Can you have a shorthand if..else if..else ? Try: $time = (intval(date('G')) < 12) ? 'morning' : (intval(date('G')) < 17) ? 'afternoon' : 'evening'; A
-
I registered on this site about 2 years ago with a silly username I thought was "cool" at the time - now just kinda stuck it with! A
-
AJAX requires HTTP requests - a server function.. A
-
You could convert the HTML to PDF using PHP? Prob's be some kind of page break character there.. Also you can use a CSS print media stylesheet: <link rel="stylesheet" type="text/css" media="print" href="print.css"> That would allow you to remove any headers / footers / banners / big images / etc. A
-
From: http://www.ict4lt.org/en/en_copyright.htm#owner
-
http://uk2.php.net/manual/en/ref.rar.php A
-
I'd only changed the condition in the IF .. if(document.cookie.match(/page=[\w][\w\-\.]+;/) != null) { ajaxpage("$_COOKIE['page']", "content); } else { ajaxpage("default", "content"); } A
-
Sounds like you don't have the correct permissions. Look into chmod() .. or you can do it through your FTP program (most of the time).. A
-
Change the data type to integer as well - I imagine it's treating it as a string, causing unexpected results from MAX() .. A
-
That shouldn't really effect the MAX() result, what data type is 'id'? A
-
Going to say, you don't need to loop through the results... As you're only selecting the MAX(id) it will only return a single field of data. A
-
Myyy mistake! Sorry mods!
-
Line numbers on code tags I think would be very helpful? Quite often people post a full script and then the error which say it's on line 123 for example. With line numbers could jump straight to that line, or at least very close. Also would make it a lot easier to reference a line they have an error on without having to post it saying like.. "this (...) should be this (...)" - could just say.."line #8 should be this (...)". A
-
Sorry should be: if (document.cookie.match(/page=[\w][\w\-\.]+;/) != null) { A
-
Try that.. if (document.cookie.match('page=[\w][\w\-\.]+;') != null) { This will also prevent any XSS injection, make sure the page name only includes chars: 0-9 a-z A-Z _ - . and only starts with 0-9 a-z A-Z _ * Not tested * A
-
I only had a quick look, but it would appear this line allows you to set the file name: header( "Content-Disposition: attachment; filename=".basename($file)); A
-
Check the repository: http://www.phpfreaks.com/forums/index.php/topic,95433.0.html A
-
Problem is here.. <table background="http://www.walthamforest-fc.co.uk/stats/nextmatch.jpg"> Forgot to escape your quotes... <table background=\"http://www.walthamforest-fc.co.uk/stats/nextmatch.jpg\"> I've always found it much easier to use single quotes when echoing HTML. That way you don't have to escape the double quotes for every attribute... A
-
You're querying the database twice: $results = mysql_query($query) or DIE ("could not execute query : $query." . mysql_error()); $result = mysql_query($query) or DIE("Could not Execute Query on table $usertable"); Use one or the other.. A
-
header('Location: X.php') Question... Going 2 pages back
Adam replied to jonw118's topic in PHP Coding Help
I'd recommend something along the lines of what Parhs is showing you.. But you should be able to use: header("Location: javascript:window.history.go(-2);"); ** Not tested - plus it requires the user to have JS enabled.. A -
Perhaps: if ($var_mobile_number{1} != '7'){ echo 'yes'; }else{ echo 'no'; }
-
$result = mysql_query("SELECT t1.*, t2.* from projects AS t1, providers AS t2 WHERE projects.provider_id = provider.id ORDER BY date"); Then.. while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td class='grey_link'>" . $row['t2.name'] . "</td>"; echo "<td class='grey_link'>" . $row['t1.project_title'] . "</td>"; echo "<td class='grey_link'>" . $row['t1.date'] . "</td>"; echo "</tr>"; } This isn't checked... EDIT: gevans beat me too it with a pretty similar solution.. A