0

I have been doing some research on mobile websites, and thus far it seems to me that PHP is not supported by most handsets.

I am trying to create multiple form's that lead up to a auto email response, which would be fairly simple if I could use PHP.

Is there any other way of achieving this?

Odyss3us
  • 6,457
  • 18
  • 74
  • 112
  • 2
    Are you trying to run PHP directly on the handset or are you using it to power a website to be viewed by the handset? – jamiei Apr 26 '10 at 07:22
  • I am trying to pass form values via POST to PHP functions, so I am trying to use it directly on the handset. – Odyss3us Apr 26 '10 at 07:24
  • 4
    @kielie: No... you're not. When you submit a form through your mobile handset's browser, the response is sent back to the server as a POST variable. Your *server* then parses this, and the PHP interpreter on your *server* stuffs it into a nice easy to access `$_POST` variable. You have a big misunderstanding here. – mpen Apr 26 '10 at 07:28
  • Oh ok, I see, didn't know that, I'm still learning, please forgive my lack of knowledge. – Odyss3us Apr 26 '10 at 07:37
  • This is being asked frequently on SO, check the search for previous questions on the issue. A quick search turns up this one: http://stackoverflow.com/questions/1607047/best-practice-for-developing-webpage-for-mobile-phone – Mohit Jain Apr 26 '10 at 08:35

4 Answers4

7

PHP is server side language, your server has to be support for it. handsets should support html or whatever you output with php.

Lauri
  • 1,298
  • 11
  • 13
3

PHP is usually executed on the server, not the handset itself, so the question is more if your PHP spits out HTML unsuited for a handset.

Johann Gerell
  • 24,991
  • 10
  • 72
  • 122
1

Yes - its perfectly possible to write WML using PHP, only vaveat is that you need to add a custom header to set the mimetype if your default behaviour for PHP files is to return text/html. And, of course you need to understand WML - which is quite different from HTML.

These days a lot of handhelds can now cope with HTML although don't expect javascript.

PHP is not supported by most handsets

Eh? What's that got to do with it? PHP runs on the server - not on the client.

C.

symcbean
  • 47,736
  • 6
  • 59
  • 94
  • That is what I read on a few forums actually, no jokes, but now that you've all cleared that up for me, I don't know how the heck they could ever have said something like that, next time I'll just post the question on SO first! – Odyss3us Apr 26 '10 at 08:33
0

Have a read up on the basic request/response cycle for a web page.

Assuming by "mobile website" you mean "a normal website that is tailored for display on a mobile device" the answer is that PHP runs on the server not the client, the client only displays HTML given to it by the server.

Paolo
  • 22,188
  • 6
  • 42
  • 49