Child pages
  • Chapter 5 - Modification - Update client

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
foreach ( $resources as $key => $resource ) {
  echo '<tr><th>' . $key . '</th><td>';
  echo '<input type="text" name="' . $key . '" value="' . $resource . '"/>';
  echo '</td></tr>';
}

Once

...

the

...

XML

...

file

...

is

...

retrieved

...

we

...

need

...

to

...

modify

...

the

...

new

...

data

...

with

...

data

...

received

...

by

...

POST.

...

Path

...

of

...

the

...

keys

...

in

...

the

...

XML

...

file

...

and

...

update

...

values:

Code Block
foreach 

...

( $resources as $nodeKey => $node ) {

...


  $resources->$nodeKey = $_POST[ $nodeKey ];

...


}
Code Block

We

...

now

...

have

...

an

...

XML

...

file

...

updated.

...

Now

...

we

...

just

...

need

...

to

...

send

...

it.

...

Example

...

of

...

an

...

update:

Code Block
$opt 

...

= array( 'resource' => 'customers' ); // Resource definition

...


$opt[ 'xml' ] = $xml->asXML(); //XML file definition

...


$opt[ 'id' ] = $_GET[ 'id' ]; // Definition of ID to modify

...


// Calling asXML () returns a string corresponding to the file

...


$xml = $webService->edit( $opt ); // Call
Code Block

Now, in your U-CRUD.php script, try to modify a customer with an ID defined in the code, then do it for all customers.

...