Search found 7 matches

by pa28
Fri Oct 16, 2009 1:39 am
Forum: PHP - Code
Topic: Passing PHP variables to Javascript
Replies: 4
Views: 503

Re: Passing PHP variables to Javascript

I'm not too familiar wit JSON Or XML but here's what I have so far but it doesn't work though. What's wrong with it? :roll: You need to quote the $element within your echo statement, otherwise JavaScript will think you're trying to add variables called 'list', 'of', and 'elements' to the array - an...
by pa28
Sun Oct 11, 2009 12:14 am
Forum: PHP - Code
Topic: I Don't Know
Replies: 1
Views: 106

Re: I Don't Know

It's not magic, but there is a script here that should do what you want: PHP Form Mailer.
by pa28
Fri Oct 09, 2009 2:17 am
Forum: PHP - Code
Topic: .png if else statement.
Replies: 7
Views: 318

Re: .png if else statement.

There is no way in PHP to 'ask' a browser whether it supports PHP - McInfo 's suggestion of looking at the user agent string and comparing it to your own database of supported browsers is the best you'll be able to do. Having said that, the only modern browser I'm aware of that doesn't support trans...
by pa28
Fri Oct 09, 2009 1:59 am
Forum: PHP - Code
Topic: Exclude content when using include
Replies: 3
Views: 88

Re: Exclude content when using include

Right... define a variable in your 'including' file - i.e. the one which is including the other:

Code: Select all

$isIncluded = true;
And then in your included file:

Code: Select all

 
Display this bit.
And this bit.
<?php if(!isset($isIncluded)) { ?>
But not this bit.
<?php } ?>
 
by pa28
Fri Oct 09, 2009 12:53 am
Forum: PHP - Code
Topic: How to replace some text in a file after searching
Replies: 2
Views: 74

Re: How to replace some text in a file after searching

I think I know what you're looking for - let me know if I've misunderstood. As a simple example, suppose you want to replace all instances of the word "dog" with "cat":   $filePath = "myfile.txt";   $contents = file_get_contents($filePath); $contents = str_replace("...
by pa28
Fri Oct 09, 2009 12:12 am
Forum: PHP - Code
Topic: How can I pass a veriable -----
Replies: 2
Views: 79

Re: How can I pass a veriable -----

Because your $r variable is created within a set of braces ( {} ), it is only accessible within those braces. You either need to define it outside of your 'if' statement, or define it within each set of braces. The first method is neater IMHO:   if(isset($_POST['go']) || isset($_POST['sub']) {     $...
by pa28
Fri Oct 09, 2009 12:01 am
Forum: PHP - Code
Topic: Re: Explode Function - Delimiter issue?
Replies: 4
Views: 169

Re: Explode Function - Delimiter issue?

If you're on Windows, use \r\n... otherwise, \n... Using \n in the explode() function will be compatible with both Windows and non-Windows systems. Then use trim($quote[0]) etc. to remove the redundant \r, if present. EDIT: On second thoughts, you could do away with the file_get_contents() and just...