php-general Digest 22 Jun 2013 19:11:04 -0000 Issue 8273

Topics (messages 321444 through 321453):

Newbie form question
        321444 by: Karl-Arne Gjersøyen
        321445 by: Jim Giner

PHP5 OOP: Abstract classes, multiple inheritance and constructors
        321446 by: Micky Hulse
        321447 by: Micky Hulse
        321451 by: David Harkness
        321452 by: Micky Hulse

Re: PHP 5.5.0 final has been released!
        321448 by: Julian

Re: [PHP-DEV] [PHP] PHP 5.5.0 final has been released!
        321449 by: Martin Amps
        321450 by: Daniel

scandir doesn't find all files
        321453 by: Daniel Pöllmann

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-gene...@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
Hello.

I have an application that generete HTML5 form in PHP.
The form is written in a while loop and therefore the form field has exact
same name for every row in the loop.
And that is the problem. Because when my PHP document shall handle
submitted data it only take the very last row in the while loop and show
the result of it.

if(isset($_POST['update_explosive'])){
    $item_serial_number = $_POST['item_serial_number'];
    $update_item_in_store = $_POST['update_item_in_store'];

    if($item_serial_number === "ETX1.22X1000"){
        echo "<h1>$update_item_in_store</h1>";
        }
    if($item_serial_number === "ETX1.17X460"){
        echo "<h1>$update_item_in_store</h1>";
        }
    }

I think the solution will be to create different and unike fieldname
dymamic. For example I tried to write <input type="text" name="<?php echo
"$item_serial_number"; ?>" value="<?php echo "$item_serial_number"; ?>"> in
the HTML5/PHP form.

But the problem is that periode "." not is allowed as $variable_name.
I then try to write it this way:

if(isset($_POST['update_explosive'])){
    $item_serial_number = $_POST['ETX1.22X1000'];
    $update_item_in_store = $_POST['update_item_in_store'];

    if($item_serial_number === "ETX1.22X1000"){
        echo "<h1>$update_item_in_store</h1>";
        }
    if($item_serial_number === "ETX1.17X460"){
        echo "<h1>$update_item_in_store</h1>";
        }
    }

But this last part did not make any sense to me. I recive no output when
tried that one.

One problem is that I have between 2 and 25 items with different serial
number. Sometimes only 5 of this shall be updated and other times all 25
items. I like to do this through one simple form and not for one time for
every single item. (I know how to do when select one by one and update
them, but that is a long and hard way for people using my application. A
better solution is to just use one form and view all items there. Then just
write the amount of item in <input type="number"
name="update_item_in_store" size="6"> field.)

If you have time to help me *understand* this newbie question by explain or
give me an example or post a link to a tutorial that can help me though, I
am very thankful.

Karl

--- End Message ---
--- Begin Message ---
On 6/21/2013 10:09 AM, Karl-Arne Gjersøyen wrote:
Hello.

I have an application that generete HTML5 form in PHP.
The form is written in a while loop and therefore the form field has exact
same name for every row in the loop.
And that is the problem. Because when my PHP document shall handle
submitted data it only take the very last row in the while loop and show
the result of it.

if(isset($_POST['update_explosive'])){
     $item_serial_number = $_POST['item_serial_number'];
     $update_item_in_store = $_POST['update_item_in_store'];

     if($item_serial_number === "ETX1.22X1000"){
         echo "<h1>$update_item_in_store</h1>";
         }
     if($item_serial_number === "ETX1.17X460"){
         echo "<h1>$update_item_in_store</h1>";
         }
     }

I think the solution will be to create different and unike fieldname
dymamic. For example I tried to write <input type="text" name="<?php echo
"$item_serial_number"; ?>" value="<?php echo "$item_serial_number"; ?>"> in
the HTML5/PHP form.

But the problem is that periode "." not is allowed as $variable_name.
I then try to write it this way:

if(isset($_POST['update_explosive'])){
     $item_serial_number = $_POST['ETX1.22X1000'];
     $update_item_in_store = $_POST['update_item_in_store'];

     if($item_serial_number === "ETX1.22X1000"){
         echo "<h1>$update_item_in_store</h1>";
         }
     if($item_serial_number === "ETX1.17X460"){
         echo "<h1>$update_item_in_store</h1>";
         }
     }

But this last part did not make any sense to me. I recive no output when
tried that one.

One problem is that I have between 2 and 25 items with different serial
number. Sometimes only 5 of this shall be updated and other times all 25
items. I like to do this through one simple form and not for one time for
every single item. (I know how to do when select one by one and update
them, but that is a long and hard way for people using my application. A
better solution is to just use one form and view all items there. Then just
write the amount of item in <input type="number"
name="update_item_in_store" size="6"> field.)

If you have time to help me *understand* this newbie question by explain or
give me an example or post a link to a tutorial that can help me though, I
am very thankful.

Karl

Make your names on your input tags like this:
if you currently have
<input type='text' name='field1'>
then change it to this:
<input type='text' name='field1[]'>

This will give you an array of in your POST/GET array.



--- End Message ---
--- Begin Message ---
Example/working code here:

<https://gist.github.com/mhulse/5833826>

Couple questions:

1. Is there anything wrong with the way I'm using the abstract class?
If so, how could I improve the logic/setup?

2. Is there a way for me to pass $foo to the parent class, from the
child, without having to ferry that variable through the abstract
class? In other words, is there such a thing as:

parent::parent::__construct($foo);

... I want to have my abstract class constructor do things, yet I'd
like to avoid having to repeat myself for when it comes to passing
constructor arguments from the child.

Any tips would be appreciated. Sorry if silly questions.

Thanks!
Micky

--- End Message ---
--- Begin Message ---
On Fri, Jun 21, 2013 at 12:54 PM, Micky Hulse
<mickyhulse.li...@gmail.com> wrote:
> 2. Is there a way for me to pass $foo to the parent class, from the
> child, without having to ferry that variable through the abstract
> class?

I should mention, I'm working on some code where I don't have the
ability to modify the "parent" class.

I'd still like to know how to improve my demo code in general, but I'm
working on a project where the parent class is off bounds in terms of
modifying.

--- End Message ---
--- Begin Message ---
There's no way to bypass an overridden method using "parent", but you could
add an abstract method that Child would implement.

    class Parent
        function __construct() {
            $this->foo = $this->getFoo();
        }

        abstract function getFoo();
    }

David

--- End Message ---
--- Begin Message ---
Thanks for tips David! I'll play with your suggestion.

I've never used abstract methods, but if I'm understanding the code
you posted, they look pretty useful.

I may be back with questions.

Appreciate the help. :)

--- End Message ---
--- Begin Message ---
Awesome work and the new design for the php.net website is also nice ;)

Am 20.06.2013, 23:22 Uhr, schrieb Julien Pauli <jpa...@php.net>:

Hello!

The PHP Development Team would like to announce the immediate release of
PHP 5.5.0. This release includes a large number of new features and bug
fixes.

A separate release announcement is also available. For changes in PHP
5.5.0 since PHP 5.4, please consult the PHP 5 ChangeLog.

Release Announcement: http://www.php.net/release_5_5_0.php
Downloads:            http://www.php.net/downloads.php#v5.5
Changelog:            http://www.php.net/ChangeLog-5.php#5.5.0

Thanks to all contributors that made this new version available.

regards,

David Soria Parra & Julien Pauli

--- End Message ---
--- Begin Message ---
I second this - great to see both finally available. Fantastic release!

Martin Amps | CIO
www.iCracked.com
iCracked | Redwood City, CA

On Jun 21, 2013, at 2:01 PM, Julian <jswprog.mailingli...@gmx.at> wrote:

> Awesome work and the new design for the php.net website is also nice ;)
> 
> Am 20.06.2013, 23:22 Uhr, schrieb Julien Pauli <jpa...@php.net>:
> 
>> Hello!
>> 
>> The PHP Development Team would like to announce the immediate release of
>> PHP 5.5.0. This release includes a large number of new features and bug
>> fixes.
>> 
>> A separate release announcement is also available. For changes in PHP
>> 5.5.0 since PHP 5.4, please consult the PHP 5 ChangeLog.
>> 
>> Release Announcement: http://www.php.net/release_5_5_0.php
>> Downloads:            http://www.php.net/downloads.php#v5.5
>> Changelog:            http://www.php.net/ChangeLog-5.php#5.5.0
>> 
>> Thanks to all contributors that made this new version available.
>> 
>> regards,
>> 
>> David Soria Parra & Julien Pauli
> 
> -- 
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php


--- End Message ---
--- Begin Message ---
I hope this will get people like WordPress to get up and support
mysqli out of the box..... going to cause big issues if they don't.






On Sat, Jun 22, 2013 at 8:59 AM, Martin Amps <ph...@rtin.so> wrote:
> I second this - great to see both finally available. Fantastic release!
>
> Martin Amps | CIO
> www.iCracked.com
> iCracked | Redwood City, CA
>
> On Jun 21, 2013, at 2:01 PM, Julian <jswprog.mailingli...@gmx.at> wrote:
>
>> Awesome work and the new design for the php.net website is also nice ;)
>>
>> Am 20.06.2013, 23:22 Uhr, schrieb Julien Pauli <jpa...@php.net>:
>>
>>> Hello!
>>>
>>> The PHP Development Team would like to announce the immediate release of
>>> PHP 5.5.0. This release includes a large number of new features and bug
>>> fixes.
>>>
>>> A separate release announcement is also available. For changes in PHP
>>> 5.5.0 since PHP 5.4, please consult the PHP 5 ChangeLog.
>>>
>>> Release Announcement: http://www.php.net/release_5_5_0.php
>>> Downloads:            http://www.php.net/downloads.php#v5.5
>>> Changelog:            http://www.php.net/ChangeLog-5.php#5.5.0
>>>
>>> Thanks to all contributors that made this new version available.
>>>
>>> regards,
>>>
>>> David Soria Parra & Julien Pauli
>>
>> --
>> PHP Internals - PHP Runtime Development Mailing List
>> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---
Hi,
I have some files in a directory - some are uploaded via ftp and some other
are created by a php script.

Scandir just finds the uploaded files, but none of the created files.
I can't run chown() because the server is part of shared hosting.

I can't find anything about this behavour in the documentation.

Best wishes,
Daniel

--- End Message ---

Reply via email to