I would like to know how to load data from one HTML into another

-1

I need to load in a new HTML the data provided by the first one (HTML) to make the change. The proposal of the activity that I am in doubt is the following:

"Once the customer registration is done, a link to the customer data change page that has just been inserted should be displayed."

The Registration screen works but I need to know how to load the data on the new change page.

    
asked by anonymous 07.07.2016 / 22:22

1 answer

0

Thomaz,

Your first HTML record probably saved the data in a database, right?

When you view the second change page, you should:

  • Get the previously registered database data (with PDO, mysqli_ * functions or some ORM)
  • Place these values in your HTML form, for example:

    <input type="text" name="nome_usuario" value="<?=$usuario['nome']?>" />
    
  • And perform the change action of the new one on the new form.

  • If you want to use the same HTML form both on the registration page and on the editing page you need to take care of three things:

  • Change the form's action if it is editing or registering:
  • <form action=""<?=$urlCadastrarOuAlterar?>"
    
  • In the values of the fields, you will have to check if there is a user:
  • <input type="text" name="nome_usuario" value="<?=isset($usuario) ? $usuario['nome'] : ''?>" />
    
  • In the case of editing, save the user id in a hidden field.
  • 08.07.2016 / 14:20