This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: getting value of input to *.php
(Where's the XSL question in all of this? More below...)
At 05:29 AM 6/18/2002, you wrote:
That looks something like what I want to do. Is there a way of
structuring what you suggest so that:
> the result is like http:www.whatevrurl.com?page=15
^^
when I type into the text box and return, the value corresponds to the ^^
item only. All I want to do is use the textbox to change that last
value. Also, When I hit return, nothing happens. There is no action
whatsoever. What is wrong?
In PHP 4.1.x, use the global variable $_SERVER["QUERY_STRING"] to access
everything after the "?" in the GET method of a posted URL. Alternatively,
you can use the POST method (much better and doesn't run into data length
limitations as quickly in browsers). When POSTing, the data will be stored
in the receiving PHP page as the global array $_POST. For the above
example, $_POST["page"] would be 15. Also, the form action would only be
"http://www.whatevrurl.com/". All in all, it might read
<form action="http://www.whatevrurl.com/" method="post">
<input type="text" name="page" value="<?php
if (isset($_POST["page"]))
echo $_POST["page"];
?>" />
</form>
You also wrote:
> Hmmm, that might be the problem. I don't have any form
> element. I am very new to this and wasn't sure how to
> put it together.
Depending on what you're using to view the final HTML construct (after
PHP is done), it may not work w/o the form element. I believe Netscape 4
ignored all input elements that did not belong to a form. I have not
tested Netscape 6. I know IE always allowed it, even though it is very sloppy.
Greg Faron
Integre Technical Publishing Co.
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list