I am a PHP beginner and need some help.
I have a config.data file that has the $logins array serialized in it. (thanks @Barmar!) I have signin.php (below) which I would like to modify in the following way:
- Add a 'add project' button which would append the info to the $logins array
- Add a 'delete project' button which would delete the info to the $logins array.
Any help to accomplish these two goals would be appreciated!
config.data:
$logins = array(
'project1' =>
array(
'password' => 'mypassword',
'title' => 'Capacitors Project Planner',
'emails' => array('myweb@mywebsite.com')
),
'project2' =>
array(
'password' => 'mypassword2',
'title' => 'My second project',
'emails' => array('manager@youwebsite.com',
'worker@youwebsite.com')
)
);
signin.php:
require_once( 'config.php' );
//displays arrays
<table class="table" border='1'>
<thead>
<tr>
<th> Project name</th>
<th> Project Login</th>
</tr>
</thead>
<tbody>
<?php foreach( $logins as $projname => $projinfos ): ?>
<tr>
<td><?= $projname ?></td>
<td><?= $projinfos["title"]?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
via Chebli Mohamed