KevinM1
Moderators-
Posts
5,222 -
Joined
-
Last visited
-
Days Won
26
Everything posted by KevinM1
-
It should be noted that directly accessing object properties is a Bad Idea. You should implement accessor functions instead.
-
A couple of things: 1. $(document).ready() should be used at the beginning of your JavaScript code, and not within a function. I'm not sure you even need to use it, in this instance, given what you're trying to do. 2. Look at your code closely. Your function attempts to add an event handler function to the click event of an element with an id of myButton. You don't have such an element. Your function should simply look like: function ItemSelected(file) { alert(file); $("#message-paragraph").load(file); }
-
Hehe, no problem. I've done the same thing many times myself.
-
Have you tried changing the sendmail.php code to: $_POST['Email'] ?? I ask, because the name component of the name-value pairs you send via the poststr variable all have their first letters as uppercase.
-
to sendform.php Set, not sent . Where/how is the poststr variable actually being assigned to?
-
Hmm...where is poststr being set?
-
FYI, most AI research is done in Lisp, which can be used as a scripting language if you want to. I wouldn't want to, though. Also, Lisp is a hell of a lot more efficient than PHP. Running something as a script always incurs the cost of accessing the interpreter. Given the OP's requirements/ideas of AI, I'd want my program(s) to run directly on the hardware.
-
One line of code isn't enough to diagnose the problem.
-
Also, if you want to get into AI, PHP isn't the way to go. Not because of its function list, but because of what PHP is. It's an interpreted scripting language. Meaning, code is read and executed in the exact way it's written - top-down, till the bottom of the page. Because it's interpreted, it's slow. It's good enough for web apps, but for something that requires real speed it's definitely not the way to go. And then there's the inability to access dynamic memory.... No, if you're interested in AI, you'll need a compiled language, like C/C++.
-
Let me guess... your 'str' value comes from some form field or query string, right? If so, it's being treated as a string and not a number. To fix it, run it through the parseInt() function: function showUser(str) { str = parseInt(str); if(str == 5) { string = "Name: Harold<br>Location: Montreal, Canada"; document.getElementById('txtHint').innerHTML = string; } else { alert("Wrong ID, Please try again"); } }
-
Yeah, that's an example of one of the benefits. The example I read (which was lame, but still illustrated the point) was say you're 'survivor' type show is on in a few hours, and you live on the west coast.. in theory, nothing stops you from checking the results of who got ousted on Twitter before the show is on in your time zone. People can post results on Twitter once they see the show (and assume they are a few time zones a head of you). While popular websites are updated with half decent speed, I don't think it compares to Twitter in that regard. Like you say, that's a lame example because the same could be said for any message board or wiki. The hook for Twitter is that it's essentially a RSS aggrigator (sp?), only the feeds are other people that you subscribe to. It's pretty much the same thing as Facebook's status update feature, without the stupid 160 character limit. I haven't played around with it much myself, so I'm wondering how the updates are displayed. If there's some real time AJAX-driven mojo that automatically makes the updates appear on the screen after each submission or comment, it'd be perfect for the revolutionary on the run.
-
FWIW, Twitter posts have been describing the situation in Iran with greater frequency and more accuracy than any American MSM source. Things that have later been verified by photos, videos, and reporters hours later.
-
It's a syntax error. You simply need: if(!isset($val)) { /* code */ } The '!' is a logical NOT, so the expression literally says "If $val IS NOT set, execute the following code." EDIT: Remember also that checking to see if a value is set is NOT the same as checking whether it's value is false.
-
Is the text stored with a tab in the db? Also, are there any attributes set in your textarea element?
-
[SOLVED] object doesn't support this property or method
KevinM1 replied to SchweppesAle's topic in Javascript Help
Unfortunately, baffling error messages are what IE is known for. Double unfortunately, I didn't get any errors in FF, so I can't use Firebug to point me in the direction of where your error lies. I'm guessing, since the error is being reported right at the beginning of the document, that either it's choking on some library/framework code, or one of the initial lines of your code. Specifically, I'd look to see if the Mootools addEvent function is behaving properly. You should also double-check that your various bits of library code can co-exist with one another. There's a chance that there's a pesky interoperability issue that IE can't resolve. If the problem persists, the only thing I can suggest is to create a fresh page as a test bed. Add each external .js file to it and test it before moving to the next. As you slowly rebuild your code in that test page, you should be able to detect when the error pops back up, which should (hopefully) give you an idea of what the culprit is. -
Query works except when variable has apostrophe in it
KevinM1 replied to ArizonaJohn's topic in PHP Coding Help
Sorry...I thought your problem was with $site. And, ted's right with your variable assignment problems. As an aside, rather than pass the db table name as an encoded query string, why not pass it is a hidden form field? That will remove the need to encode/decode it, as well as stop it from being immediately visible (and editable) in the user's address bar. -
Query works except when variable has apostrophe in it
KevinM1 replied to ArizonaJohn's topic in PHP Coding Help
http://www.php.net/manual/en/function.mysql-real-escape-string.php -
You're actually on the right track. Remember that functions can take arguments and return values. So, you can pass in your error_msg array to the validation functions and add an error message, if need be. This will allow you to also forgo using the dreaded 'global' keyword, which should be avoided where possible. So, you have your error_msg array... $error_msg = array(); Now you need to pass it to your validation functions. You'll need to pass it by reference (don't worry if you don't understand that) to ensure that any changes made by the functions persist outside of them. So... function check_names(&$error_msg) { /* pre-existing name validation code goes here */ } function check_email(&$error_msg) { /* pre-existing email validation code goes here */ } function show_receipt($pizza) { /* pre-existing receipt code - WITHOUT 'global $pizza' - goes here */ } function show_form($error_msg, $array_pizza, $array_toppings, $data) { /* pre-existing form code - WITHOUT any of the globals - goes here */ } Let me know if this helps.
-
Extracting cookie data whilst using a class
KevinM1 replied to madspof's topic in Third Party Scripts
Hehe EDIT: I admit, though, that the wording to that initial "it ain't gonna work" response was a bit awkward...even I went "what the hell was I trying to say?" when I re-read it. -
Extracting cookie data whilst using a class
KevinM1 replied to madspof's topic in Third Party Scripts
He'd also need to write a new method, or edit an existing one, to actually do something useful with his new $rank property. -
[SOLVED] PHP - Making results into links - Help please.
KevinM1 replied to ryanwood4's topic in PHP Coding Help
Remove the line starting with // -
Extracting cookie data whilst using a class
KevinM1 replied to madspof's topic in Third Party Scripts
Okay, I see it...it was buried under mounds of over-commented code. Here's the thing - you can't pass a value to an object and automatically expect it to work. The class that the object is an instance of needs to be written in such a way that it can handle your cookie data. Right now nothing is happening because, from what I can see, the calender knows nothing about 'rank' or anything else of that nature. -
Extracting cookie data whilst using a class
KevinM1 replied to madspof's topic in Third Party Scripts
What exactly are you trying to do with the cookie info? Are you trying to pass it to the calender object? If so, what are you hoping to accomplish? -
[SOLVED] PHP - Making results into links - Help please.
KevinM1 replied to ryanwood4's topic in PHP Coding Help
You don't have to use <?= $fileurl; ?> Since you're already within a PHP code block. You also need to encase any array value you want to be parsed within a string (in this case, $row['article_title']) in curly braces. So, with all that said, simply use: $url = $row['article_url'] . "-" . $row['article_id'] . ".html"; echo "<a href='$url'>{$row['article_title']}</a>"; -
Extracting cookie data whilst using a class
KevinM1 replied to madspof's topic in Third Party Scripts
You need to provide more information. What does your class look like? Is it instantiated? What about the main code, where you're trying to use the cookie?