Jump to content

Need help with a php form


dlandon

Recommended Posts

I am using the following code to change a .cfg file and then execute a php after the changes are made:

 

	<form markdown="1" name="vfs_recycle_settings" method="POST" action="/update.php" target="progressFrame">
<input type="hidden" name="#file" value="vfs_recycle/vfs_recycle.cfg">
<input type="hidden" name="#include" value="/plugins/vfs_recycle/include/update.vfs_recycle.php">
Enable Recycle Bin:
: <select name="SERVICE" size="1">
	<?=mk_option($vfs_recycle_cfg['SERVICE'], "disable", "No");?>
	<?=mk_option($vfs_recycle_cfg['SERVICE'], "enable", "Yes");?>
  </select>

Remove trash once a week:
: <select name="WEEKLYRUN" size="1";>
	<?=mk_option($vfs_recycle_cfg['WEEKLYRUN'], "yes", "Yes");?>
	<?=mk_option($vfs_recycle_cfg['WEEKLYRUN'], "no", "No");?>
 </select>

Remove files older than (minutes):
: <input type="text" name="AGE" class="arrow" maxlength="5" value="<?=$vfs_recycle_cfg['AGE'];?>">

<input type="submit" name="#default" value="Default">
: <input type="submit" name="#apply" value="Apply"><input type="button" value="Done" onclick="done()">
</form>

 

What seems to be happening is the update_vfs_recycle.php is getting executed before the vfs_recycle.cfg file has been updated.  I need to have the .cfg file updated because I execute a script that uses the new values of the .cfg file.

 

Can anyone suggest what I am doing wrong here?

Link to comment

#include is used to execute a PHP script before settings are saved.

 

#command is used to execute any command or script after settings are saved.

 

You can turn the PHP script into an independent script by including the first line: #!/usr/bin/php (and optionally remove the .php extension).

Then use something like this:

 

<input type="hidden" name="#command" value="/plugins/vfs_recycle/scripts/update.vfs_recycle">

 

Edit: corrected typo

 

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...