RE: [PHP] why doesn't this work ?

2004-04-20 Thread Justin Palmer
I don't think that you have to request anything.  I think you can do
this with a .htaccess file. Like so:

AddType application/x-httpd-php .html
AddType application/x-httpd-php .htm  

This would go in your root .htaccess file.  Mine allows this
anyways(hostrocket.com).

Also if you have a control panel that you can add MIME type, you can do
the following:

application/x-httpd-php

Here is the link with the information:

http://support.hostrocket.com/index.php?page=index_v2id=110c=15

NOTE:

This might be hosting provider specific, I have not run any tests on
other providers.

Kind regards,

Justin.

P.S. WOW, this is a late response...sorry.

-Original Message-
From: John W. Holmes [mailto:[EMAIL PROTECTED] 
Sent: Saturday, April 17, 2004 12:20 PM
To: Pooya Eslami
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] why doesn't this work ?


Pooya Eslami wrote:

 I took out the scrip tags and put in ?php in the beginning and ?  at

 the end, but it returns this:
 
 $file
 ; } } closedir($handle); } echo 
 ; ?
 
 Any ideas how to fix this?

Use a .php extension on your file. Or you can ask your hosting company 
to have .html files processed as PHP, but they won't.

-- 
---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals - www.phparch.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] why doesn't this work ?

2004-04-18 Thread Pooya Eslami
Yes, the server supports php, and I don't want to make it into a php file
because its a big html file and I just need this little script on it. Why
cannot I embed php in html files?


Andy Ladouceur [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 It's already been mentioned, but you do need to ensure you are using a
 .php extension on the file. Also, forgive me if this has already been
 covered, but are you sure the server even supports PHP?

 Try creating a new file with:
 ?php
 phpinfo();
 ?

 And save it as something.php, check and see if it returns a table full
 of information or not.

 Andy

 Pooya Eslami wrote:
  I put this in the body of an html file:
 
  ?php
  if ($handle = opendir('.')) {
 while (false !== ($file = readdir($handle))) {
 if ($file != .  $file != ..  eregi('\.html$', $file)) {
 echo lia href=\$file\font color=\#CC\$file/
 
  font/a/libr;
 }
 }
 closedir($handle);
  }
 
  echo /ul;
  ?
 
  the output page contains :
 
  $file
  ; } } closedir($handle); } echo 
  ; ?
 
  I don't understand why.
 
  Daniel Clark [EMAIL PROTECTED] wrote in message
  news:[EMAIL PROTECTED]
 
 Can you post the code and error.
 
 
 
 I took out the scrip tags and put in ?php in the beginning and ?  at
 
  the
 
 end, but it returns this:
 
 $file
 ; } } closedir($handle); } echo 
 ; ?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] why doesn't this work ?

2004-04-18 Thread Robert Cummings
On Sun, 2004-04-18 at 10:27, Pooya Eslami wrote:
 Yes, the server supports php, and I don't want to make it into a php file
 because its a big html file and I just need this little script on it. Why
 cannot I embed php in html files?

You CAN embed PHP in .html files PROVIDED THAT YOUR WEBSERVER HAS
ENABLED SUPPORT. Since you do not have access to the webserver then it
is up to your provider to enable support. Generally they WILL NOT enable
support since the .html extension is reserved for non-scripted HTML
content. This means developers can lessen the load on the server by not
having regular HTML content pass through a script interpreter. Your
needs are in the minority, so it's suck it in time where you either
remove the dynamic part, change the extension, or start hosting your own
webserver.

Cheers,
Rob.

 Andy Ladouceur [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
  It's already been mentioned, but you do need to ensure you are using a
  .php extension on the file. Also, forgive me if this has already been
  covered, but are you sure the server even supports PHP?
 
  Try creating a new file with:
  ?php
  phpinfo();
  ?
 
  And save it as something.php, check and see if it returns a table full
  of information or not.
 
  Andy
 
  Pooya Eslami wrote:
   I put this in the body of an html file:
  
   ?php
   if ($handle = opendir('.')) {
  while (false !== ($file = readdir($handle))) {
  if ($file != .  $file != ..  eregi('\.html$', $file)) {
  echo lia href=\$file\font color=\#CC\$file/
  
   font/a/libr;
  }
  }
  closedir($handle);
   }
  
   echo /ul;
   ?
  
   the output page contains :
  
   $file
   ; } } closedir($handle); } echo 
   ; ?
  
   I don't understand why.
  
   Daniel Clark [EMAIL PROTECTED] wrote in message
   news:[EMAIL PROTECTED]
  
  Can you post the code and error.
  
  
  
  I took out the scrip tags and put in ?php in the beginning and ?  at
  
   the
  
  end, but it returns this:
  
  $file
  ; } } closedir($handle); } echo 
  ; ?
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] why doesn't this work ?

2004-04-18 Thread Marek Kilimajer
Pooya Eslami wrote:
Yes, the server supports php, and I don't want to make it into a php file
because its a big html file and I just need this little script on it. Why
cannot I embed php in html files?
The server does not parse html files for php so that it does not waste 
CPU on parsing files that don't have any php code.

Simply give that file php extension.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] why doesn't this work ?

2004-04-18 Thread Daniel Clark
You have this as a xxx.php file right?

It has to have a .php extension for it to work.

I put this in the body of an html file:

?php
if ($handle = opendir('.')) {
   while (false !== ($file = readdir($handle))) {
   if ($file != .  $file != ..  eregi('\.html$', $file)) {
   echo lia href=\$file\font color=\#CC\$file/

font/a/libr;
   }
   }
   closedir($handle);
}

echo /ul;
?

the output page contains :

$file
; } } closedir($handle); } echo 
; ?

I don't understand why.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] why doesn't this work ?

2004-04-18 Thread Daniel Clark
The web server is set up to see the .php file extension and pass the entire page to 
the PHP engine for processing.   Then the web server passes the 
results back to the client's browser  ( HTML, text, and images).


Yes, the server supports php, and I don't want to make it into a php file
because its a big html file and I just need this little script on it. Why
cannot I embed php in html files?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] why doesn't this work ?

2004-04-18 Thread Dave G
 Why cannot I embed php in html files?

I'm relatively new to PHP, but I am fairly sure that it is
possible to have PHP embedded in .html files, as my web hosting service
accomplishes exactly that. I believe it's just some kind of setting in
Apache or somewhere else that you or your web hosting service can
configure.
On my web hosting service, the file can have a .html extension,
but there must be ?php ? tags at the very beginning of the file, on
the very first line before absolutely any HTML code, including doctype
headings. If you want your PHP to work it's magic somewhere else in the
page, and not at the very beginning, it's no problem, just put some
harmless bit of code at the beginning, and then place whatever it is
that you really want to do within separate ?php ? tags where you want
it.
Personally, because I work with software that generates
templates for all my web pages, I put the following code at the start of
every page:
?php
session_start();
?
I chose session_start as a command because I often need
sessions, and if there is a session, it needs to happen before the HTML
head tag anyway. If one of the pages based on my template doesn't have
a session, or even if it doesn't use any PHP at all, then the HTML
parser seems to just ignore the ?php ? tags and whatever is in it and
output the .html file no problem.

Bottom line - speak to your web hosting service about
configuring .html files to be parsed by the PHP engine. If you're
running your own server, then you'll need to consult someone more
advanced than I. Also, I can't ensure there aren't any errors or
drawbacks to my advice, I'm just relaying how my web hosting service
seems to handle the issue.

Hope that helps.

-- 
Yoroshiku!
Dave G
[EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] why doesn't this work ?

2004-04-18 Thread Andy Ladouceur
Okay, what you can do is try use an .htaccess file (providing your host 
allows them) to make the PHP engine parse .html files.

Create a file titled .htaccess with the following contents:
AddType application/x-httpd-php .php .php3 .html .htm
Upload it to the same folder that the .html file is in, and see if it works.

(Oh, and if you are using WS_FTP LE, be sure to add '-al' in the white 
box on the right [Remote] vertical line of buttons so that you are able 
to view the .htaccess file in the folder once uploaded.)

Cheers,
Andy
Pooya Eslami wrote:
Yes, the server supports php, and I don't want to make it into a php file
because its a big html file and I just need this little script on it. Why
cannot I embed php in html files?
Andy Ladouceur [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
It's already been mentioned, but you do need to ensure you are using a
.php extension on the file. Also, forgive me if this has already been
covered, but are you sure the server even supports PHP?
Try creating a new file with:
?php
phpinfo();
?
And save it as something.php, check and see if it returns a table full
of information or not.
Andy

Pooya Eslami wrote:

I put this in the body of an html file:

?php
if ($handle = opendir('.')) {
  while (false !== ($file = readdir($handle))) {
  if ($file != .  $file != ..  eregi('\.html$', $file)) {
  echo lia href=\$file\font color=\#CC\$file/
font/a/libr;
  }
  }
  closedir($handle);
}
echo /ul;
?
the output page contains :

$file
; } } closedir($handle); } echo 
; ?
I don't understand why.

Daniel Clark [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]

Can you post the code and error.




I took out the scrip tags and put in ?php in the beginning and ?  at
the


end, but it returns this:

$file
; } } closedir($handle); } echo 
; ?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] why doesn't this work ?

2004-04-17 Thread John W. Holmes
Pooya Eslami wrote:
If I put the following script in a .php file it would work but if I put it
in an .html file doesn't work, why? script tag is only used in .html file.
You web server determines whether or not to look for PHP in a file based 
upon its extension. You must set up your web server to look for PHP code 
in .html files.

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals  www.phparch.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] why doesn't this work ?

2004-04-17 Thread Pooya Eslami
How do I do that? I don't have a webserver, it is hosted by a hosting
company.


John W. Holmes [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Pooya Eslami wrote:
  If I put the following script in a .php file it would work but if I put
it
  in an .html file doesn't work, why? script tag is only used in .html
file.

 You web server determines whether or not to look for PHP in a file based
 upon its extension. You must set up your web server to look for PHP code
 in .html files.

 -- 
 ---John Holmes...

 Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

 php|architect: The Magazine for PHP Professionals – www.phparch.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] why doesn't this work ?

2004-04-17 Thread Daniel Clark
The browser doesn't know what to do with PHP code.


If I put the following script in a .php file it would work but if I put it
in an .html file doesn't work, why? script tag is only used in .html file.

script language = php
echo ul;
if ($handle = opendir('.')) {
   while (false !== ($file = readdir($handle))) {
   if ($file != .  $file != ..  eregi('\.html$', $file)) {
   echo lia href=\$file\font color=\#CC\$file/

font/a/libr;
   }
   }
   closedir($handle);
}

echo /ul;
/script


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] why doesn't this work ?

2004-04-17 Thread Daniel Clark
I should have also said:

Because it's missing the ?php and ? tags, the web server isn't going to run the 
code, but pass it back to the client browser.


If I put the following script in a .php file it would work but if I put it
in an .html file doesn't work, why? script tag is only used in .html file.

script language = php
echo ul;
if ($handle = opendir('.')) {
   while (false !== ($file = readdir($handle))) {
   if ($file != .  $file != ..  eregi('\.html$', $file)) {
   echo lia href=\$file\font color=\#CC\$file/

font/a/libr;
   }
   }
   closedir($handle);
}


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] why doesn't this work ?

2004-04-17 Thread Pooya Eslami
I took out the scrip tags and put in ?php in the beginning and ?  at the
end, but it returns this:

$file
; } } closedir($handle); } echo 
; ?

Any ideas how to fix this?


Daniel Clark [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 I should have also said:

 Because it's missing the ?php and ? tags, the web server isn't going to
run the code, but pass it back to the client browser.


 If I put the following script in a .php file it would work but if I put
it
 in an .html file doesn't work, why? script tag is only used in .html
file.
 
 script language = php
 echo ul;
 if ($handle = opendir('.')) {
while (false !== ($file = readdir($handle))) {
if ($file != .  $file != ..  eregi('\.html$', $file)) {
echo lia href=\$file\font color=\#CC\$file/
 
 font/a/libr;
}
}
closedir($handle);
 }
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] why doesn't this work ?

2004-04-17 Thread John W. Holmes
Daniel Clark wrote:

I should have also said:

Because it's missing the ?php and ? tags, the 
 web server isn't going to run the code, but pass
 it back to the client browser.
You are right, but not for the reason you think. script language=php 
is a valid way of starting PHP mode.

http://us2.php.net/manual/en/language.basic-syntax.php

Because the file extension is .html, though, the PHP engine will not 
parse any of the PHP in the file, though.

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals  www.phparch.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] why doesn't this work ?

2004-04-17 Thread Pooya Eslami
I took out the scrip tags and put in ?php in the beginning and ?  at the
end, but it returns this:

$file
; } } closedir($handle); } echo 
; ?

Any ideas how to fix this?


John W. Holmes [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Daniel Clark wrote:

  I should have also said:
 
  Because it's missing the ?php and ? tags, the
   web server isn't going to run the code, but pass
   it back to the client browser.

 You are right, but not for the reason you think. script language=php
 is a valid way of starting PHP mode.

 http://us2.php.net/manual/en/language.basic-syntax.php

 Because the file extension is .html, though, the PHP engine will not
 parse any of the PHP in the file, though.

 -- 
 ---John Holmes...

 Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

 php|architect: The Magazine for PHP Professionals – www.phparch.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] why doesn't this work ?

2004-04-17 Thread John W. Holmes
Pooya Eslami wrote:

I took out the scrip tags and put in ?php in the beginning and ?  at the
end, but it returns this:
$file
; } } closedir($handle); } echo 
; ?
Any ideas how to fix this?
Use a .php extension on your file. Or you can ask your hosting company 
to have .html files processed as PHP, but they won't.

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals  www.phparch.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] why doesn't this work ?

2004-04-17 Thread Daniel Clark
Can you post the code and error.


I took out the scrip tags and put in ?php in the beginning and ?  at the
end, but it returns this:

$file
; } } closedir($handle); } echo 
; ?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] why doesn't this work ?

2004-04-17 Thread Pooya Eslami
I put this in the body of an html file:

?php
if ($handle = opendir('.')) {
   while (false !== ($file = readdir($handle))) {
   if ($file != .  $file != ..  eregi('\.html$', $file)) {
   echo lia href=\$file\font color=\#CC\$file/

font/a/libr;
   }
   }
   closedir($handle);
}

echo /ul;
?

the output page contains :

$file
; } } closedir($handle); } echo 
; ?

I don't understand why.

Daniel Clark [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Can you post the code and error.


 I took out the scrip tags and put in ?php in the beginning and ?  at
the
 end, but it returns this:
 
 $file
 ; } } closedir($handle); } echo 
 ; ?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] why doesn't this work ?

2004-04-17 Thread Andy Ladouceur
It's already been mentioned, but you do need to ensure you are using a 
.php extension on the file. Also, forgive me if this has already been 
covered, but are you sure the server even supports PHP?

Try creating a new file with:
?php
phpinfo();
?
And save it as something.php, check and see if it returns a table full 
of information or not.

Andy

Pooya Eslami wrote:
I put this in the body of an html file:

?php
if ($handle = opendir('.')) {
   while (false !== ($file = readdir($handle))) {
   if ($file != .  $file != ..  eregi('\.html$', $file)) {
   echo lia href=\$file\font color=\#CC\$file/
font/a/libr;
   }
   }
   closedir($handle);
}
echo /ul;
?
the output page contains :

$file
; } } closedir($handle); } echo 
; ?
I don't understand why.

Daniel Clark [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Can you post the code and error.



I took out the scrip tags and put in ?php in the beginning and ?  at
the

end, but it returns this:

$file
; } } closedir($handle); } echo 
; ?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Why doesn't this work? HTTP_USER_AGENT

2001-11-27 Thread chip

This is interesting. I did my testing in Opera 5.05 and it fails to display 
the page correctly. I then opened Netscape 6.2 and it works fine. Must be a 
problem with Opera. I also set Opera to identify itself as Netscape and it 
still failed to load the page.
Thanks for the assistance.
Chip

On Monday 26 November 2001 11:11 pm, David Robley wrote:
 On Tue, 27 Nov 2001 17:43, Craig Vincent wrote:
  snip
  What have I done wrong in such a simple bit of code?
  -
  htmlheadtitle/title/head
  body
  ?
  $browser = $HTTP_USER_AGENT;
  $ip = $REMOTE_ADDR ;
  $db = mysql_connect ( localhost , username , password );
  mysql_select_db ( database , $db );
  $sql = INSERT INTO table_name(ip,browser,received)
  VALUES('$ip','$browser',now()) ;
  $results = mysql_query ( $sql);
  ?
  h1Howdy/h1
  /body/html
  
  /snip
 
  I copy  pasted your code onto a test HTML page and modified the mysql
  commands to appropriately connect to my MySQL server.  There was
  absolutely no problem with this code at all.  What version of PHP are
  you using?

 Just about to do that but he saved me the effort.

 Any chance you created the script with DOS end of line characters??

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Why doesn't this work? HTTP_USER_AGENT

2001-11-27 Thread Andrey Hristov

$sql = INSERT INTO table_name(ip,browser,received)
VALUES('.mysql_escape_string($ip).','.mysql_escape_string($browser).',now()) ;

- Original Message -
From: chip [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Tuesday, November 27, 2001 4:39 PM
Subject: Re: [PHP] Why doesn't this work? HTTP_USER_AGENT


This is interesting. I did my testing in Opera 5.05 and it fails to display
the page correctly. I then opened Netscape 6.2 and it works fine. Must be a
problem with Opera. I also set Opera to identify itself as Netscape and it
still failed to load the page.
Thanks for the assistance.
Chip

On Monday 26 November 2001 11:11 pm, David Robley wrote:
 On Tue, 27 Nov 2001 17:43, Craig Vincent wrote:
  snip
  What have I done wrong in such a simple bit of code?
  -
  htmlheadtitle/title/head
  body
  ?
  $browser = $HTTP_USER_AGENT;
  $ip = $REMOTE_ADDR ;
  $db = mysql_connect ( localhost , username , password );
  mysql_select_db ( database , $db );
  $sql = INSERT INTO table_name(ip,browser,received)
  VALUES('$ip','$browser',now()) ;
  $results = mysql_query ( $sql);
  ?
  h1Howdy/h1
  /body/html
  
  /snip
 
  I copy  pasted your code onto a test HTML page and modified the mysql
  commands to appropriately connect to my MySQL server.  There was
  absolutely no problem with this code at all.  What version of PHP are
  you using?

 Just about to do that but he saved me the effort.

 Any chance you created the script with DOS end of line characters??

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Why doesn't this work? HTTP_USER_AGENT

2001-11-26 Thread Craig Vincent

snip
What have I done wrong in such a simple bit of code?
-
htmlheadtitle/title/head
body
?
$browser = $HTTP_USER_AGENT;
$ip = $REMOTE_ADDR ;
$db = mysql_connect ( localhost , username , password );
mysql_select_db ( database , $db );
$sql = INSERT INTO table_name(ip,browser,received)
VALUES('$ip','$browser',now()) ;
$results = mysql_query ( $sql);
?
h1Howdy/h1
/body/html

/snip

I copy  pasted your code onto a test HTML page and modified the mysql
commands to appropriately connect to my MySQL server.  There was absolutely
no problem with this code at all.  What version of PHP are you using?

Sincerely,

Craig Vincent


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Why doesn't this work? HTTP_USER_AGENT

2001-11-26 Thread David Robley

On Tue, 27 Nov 2001 17:43, Craig Vincent wrote:
 snip
 What have I done wrong in such a simple bit of code?
 -
 htmlheadtitle/title/head
 body
 ?
 $browser = $HTTP_USER_AGENT;
 $ip = $REMOTE_ADDR ;
 $db = mysql_connect ( localhost , username , password );
 mysql_select_db ( database , $db );
 $sql = INSERT INTO table_name(ip,browser,received)
 VALUES('$ip','$browser',now()) ;
 $results = mysql_query ( $sql);
 ?
 h1Howdy/h1
 /body/html
 
 /snip

 I copy  pasted your code onto a test HTML page and modified the mysql
 commands to appropriately connect to my MySQL server.  There was
 absolutely no problem with this code at all.  What version of PHP are
 you using?

Just about to do that but he saved me the effort.

Any chance you created the script with DOS end of line characters??

-- 
David Robley  Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES  Flinders University, SOUTH AUSTRALIA  

   If you're not confused, you're not paying attention.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Why doesn't this work?

2001-09-16 Thread Rasmus Lerdorf

 print split(=,$testString)[0];

First, using split() on such a simple delimiter is a waste.  Use
explode().  And yes, PHP does not support automatic dereferencing of
returned arrays like that.

-Rasmus


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Why doesn't this work?

2001-09-14 Thread Jack Dempsey

php doesn't have as loose a syntax as perl or python. try this:

?
$testString = this=is=something;
print array_shift(split(=,$testString));
?

mind you, that only works because you wanted the 0th element, and shift
returns that first one...something else would be needed for any other
index...

jack

-Original Message-
From: Ray Van Dolson [mailto:[EMAIL PROTECTED]]
Sent: Friday, September 14, 2001 10:14 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Why doesn't this work?


I've come across this problem enough that I want to find out if there's a
way to make it work, or if this is just a limitation of PHP.  Here's what
I'm trying to do:

print split(=,$testString)[0];

This gives me a syntax error.  I've also tried:

print (split(=,$testString))[0];

Along with other permutations...  the only way I can get this to work how
I want it to is to create a temporary variable first.

$tempVar = split(=,$testString);
print $tempVar[0];

Now I guess this is easy enough to do, but I'm just used to doing it the
other way.  And the documentation for split() says that it should return
an Array... why can't I operate on it as I would a normal array?

Anyways, thanks for any help.  I guess I'm just too used to Python. :-D

Ray Van Dolson

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Why doesn't this work? Please trouble-shoot my script.

2001-02-05 Thread chip

I tried your suggestion, as you can see from the script below, but it
still does not work, I get the
word 'array' where I should get the selected options.
--

!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
html
head
titleSimrad USA Brochures Request Page/title
/head
body
form method = post action = 'form_combos.php'
?
$name;
$value;
while (list($name, $value) = each($HTTP_POST_VARS))
  {
   echo "input type=\"hidden\" value=\"$value\" name=\"$name\"\n";
  }
?
 Please choose the brochures you are interested in receiving.
 select name = "listbox1[]" multiple="multiple"
 option selected value = ''Select .../option
 optionAP11/option
 optionAP12/AP14/option
 optionAP20 Series/option
 optionAP35/option
 optionAP45/option
 optionAP9MK3/option
 optionTiller/Wheel Pilots/option
 optionWP5000/option
 /select
 br /
 br /
 input type="checkbox" name="AP11[]"AP11br /
 input type="checkbox" name="AP12[]"AP12/14br /
 input type="checkbox" name="AP20[]"AP20 Seriesbr /
 input type="checkbox" name="AP35[]"AP35br /
  input type="checkbox" name="AP45[]"AP45br /
  input type="checkbox" name="AP9[]"AP9MK3br /
  input type="checkbox" name="TP[]"Tiller/Wheelpilotsbr /
  input type="checkbox" name="WP[]"WP5000br /
 br /br /
 input type = submit
 /form
/body
/html


Chip Wiegand
Computer Services
[EMAIL PROTECTED]
Simrad, Inc
Lynnwood, WA
425-712-1138

"There is no reason anyone would want a computer in their home."
 --Ken Olson, president, chairman and founder of Digital Equipment
Corp., 1977
  (-- Then why do I have nine? Somebody help me!)


Please respond to [EMAIL PROTECTED]
To: Chip Wiegand
cc:

Subject: Re: [PHP] Why doesn't this work? Please trouble-shoot my
script.




On Monday, February 5, 2001, at 10:59 AM, [EMAIL PROTECTED] wrote:

 Maybe someone can take a look at the script below and tell how to make
the
 bottom part work
 the same way the top part works.

put square brackets immediately after the name element of your select
and checkbox tags. i.e.:

select name="mySelect[]" multiple="multiple"
checkbox name="myBox[]"



:: Andrew Rush :: Lead Systems Developer :: MaineToday.com ::
**

"Crippled but free, blind all the time, i was learning to see"

- J. Garcia / R. Hunter
**


The  views expressed herein are not necessarily those of my employer,
but
they let me have them anyway.






-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]