GET <===> $_GET
POST <===> $_POST
You have to change them in parallel.
Or, use $_REQUEST which has GET + POST + COOKIES in it.
On Sat, May 13, 2006 11:11 am, IraqiGeek wrote:
> On Saturday, May 13, 2006 4:59 PM GMT,
> [EMAIL PROTECTED] <[EMAIL PROTECTED]>
> wrote:
>
>> AFAIK it should be working just fine. I'm not aware of POST not
>> working in any circumstance other than PHP not working at all.
>>
>> Can you post your test script? We could better judge what's
>> happening
>> based off that. Just make sure you're referencing the variables
>> with
>> $_POST or $_REQUEST, not $_GET.
>>
>> Slightly off topic. If you're not already, always make sure to
>> verify/escape your input from POST/GET/RSS/etc. That will help make
>> your pages more secure. It might seem like you don't need to do it
>> right now at the beginning, but it's a good habit to get into... One
>> that I need to follow better (especially when I have a really short
>> deadline).
>>
>> Ray
>>
>
> PHP is indeed working. If I use METHOD=GET instead of POST, the script
> works
> without any issues. Here is the test script I'm using:
> <html>
> <title>test script</title>
> <body>
> <?php
> //If the user wants to add a joke
> if(isset($_GET['addtext'])):
> ?>//If I use METHOD=GET here, the script works flawlessly
> <form action="<?php echo($_SERVER['php_self']);?>" METHOD=POST>
> <p>Type your text here:<br>
> <textarea name="text" rows=10 cols=40 wrap></textarea></br>
> <input type=submit name="submit" value="SUBMIT">
> </form>
> <?php
> else:
> //connect to the database server
> [EMAIL PROTECTED]("localhost","username","password");
> if(!$dbcnx){
> echo("<p>Unable to connect to the database server at
> this
> time.</p>");
> exit();
> }
> //select test database
> if([EMAIL PROTECTED]("test")){
> echo("<p>Unable to locate test database at this
> time.</p>");
> exit();
> }
> //if a sample text has been submitted, add it to the database.
> if("SUBMIT"==$_REQUEST['submit']){ //I have tried _GET, _POST,
> and
> _REQUEST
> $text=$_REQUEST['text']; //Same thing here, _GET,
> _POST, and
> _REQUEST
> $sql="insert into test_table set ".
> "Text='$text', ".
> "Date=CURDATE();";
> if(mysql_query($sql)){
> echo("<p>Your text has been added.</P>");
> }
> else {
> echo("<p>Error Adding submitted text: ".
> mysql_error()."</p>");
> }
> }
> echo("<p>Here are all the texts in our database: </p>");
>
> //Request the text of all the texts
> $result=mysql_query("select Text from test_table");
> if(!$result){
> echo("<p>Error performing query:
> ".mysql_error()."</p>");
> exit();
> }
> //display the texts in a paragraph
> while($row=mysql_fetch_array($result)){
> echo("<p>".$row["Text"]."</p>");
> }
>
> //when clicked, this link will load this page with the text
> //submission form displayed.
>
> $self=$_SERVER['PHP_SELF'];
> echo("<p><a href='$self?addtext=1'>".
> "Add a text</a></p>");
> endif;
> ?>
> </body>
> </html>Thanks.
>
> Regards,
> IraqiGeek
> www.iraqigeek.com
>
> My computer isn't that nervous... it's just a bit ANSI.
>
>>> -------- Original Message --------
>>> Subject: [PHP] METHOD=POST not worikng
>>> From: "IraqiGeek" <[EMAIL PROTECTED]>
>>> Date: Sat, May 13, 2006 7:16 am
>>> To: "PHP-General" <[email protected]>
>>>
>>> Hi all,
>>>
>>> I'm learning PHP on a Debian Etch with Apache 2.0.54 and PHP
>>> 4.3.10, and using Firefox 1.5.3 on a Windows XP box to browse the
>>> sample site. I wrote a small form to get user input. If I use
>>> METHOD=GET, then the form works fine, without any glitches.
>>> However,
>>> if I use METHOD=POST in the form, I don't get the data back to the
>>> script.
>>>
>>> Googling around, I found a reference to mod_bandwidth, but AFAIK,
>>> this module is used to regulate/limit user traffic.
>>>
>>> Are there any modules missing that prvent METHOD=POST from working
>>> properly? any config files that need to be edited?
>>>
>>> Thanks.
>>>
>>> Regards,
>>> IraqiGeek
>>> www.iraqigeek.com
>>>
>>> The average woman would rather have beauty than brains, because the
>>> average man can see better than he can think.
>>>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Like Music?
http://l-i-e.com/artists.htm
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php