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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.