Re: how to delete part of string

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



What are you trying to do that $_POST can't do?  With those duplicate
'id' fields, change the input name to 'id[]' in the HTML form and PHP
will generate an array for you accessible by $_POST['id'][$index].  If
you still have a good reason for working with the raw POST data, just
apply the preg_replace code Marc gave to the content you retrieve from
php://input.

On Sat, May 23, 2009 at 11:41 AM, Grega Leskovsek <mavricek@xxxxxxxxx> wrote:
> No, I used POST and manage the data through a stream:
>
> if ($fp = fopen("php://input", 'r')) {
>   $content = '';
>
>   // keep reading until there's nothing left
>   while ($line = fgets($fp)) {
>      $content .= $line;
>
>   }
>  }
> Please advice on the matter. All the Love, Grega from Slovenia
>
> 2009/5/23 Marc Steinert <lists@xxxxxxxxxx>:
>> I guess you mean GET parameters instead of POST.
>>
>> $string = preg_replace('/^(.*?)&id=/', '&id=', $_SERVER['QUERY_STRING']);
>>
>> Don't know, if that's exactly what you wanted.
>>
>> Greetings from Germany
>>
>> Marc
>>
>>
>> Grega Leskovsek wrote:
>>>
>>> I have a POST string field and I want to skip some & fields before &id=
>>> How do I simply delete
>>> operation=nekaj&price=fddf&id=de&id=ta ...
>>> into
>>> &id=de&id=ta ...
>>>
>>> Thanks in advance,
>>
>>
>> --
>> Synchronize and share your files over the web for free
>> http://bithub.net/
>>
>> My Twitter feed
>> http://twitter.com/MarcSteinert
>>
>>
>>
>>
>>
>
>
>
> --
> When the sun rises I receive and when it sets I forgive ->
> http://users.skavt.net/~gleskovs/
> All the Love, Grega Leskov'sek
>
> --
> 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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux