unknown101 Posted May 12, 2008 Share Posted May 12, 2008 Hi guys, im using an ID3 class which extracts data from .mp3s. Everything works but fine I want to make one further change. I have added a upload part at the start of the script which copies the file to a given directory and I then went to the script to scan that directory automatically when that file is uploaded, rather than having to press 2 seperate buttons. Currently I have to upload then hit another button to run the scan function. The form which scans the directory looks like below: echo '<hr><form action="'.FixTextFields($_SERVER['PHP_SELF']).'">'; echo '<b>Warning:</b> Scanning a new directory will erase all previous entries in the database!<br>'; echo 'Directory: <input type="text" name="scan" size="50" value="'.FixTextFields($text).'"> '; echo '<input type="submit" value="Go" onClick="return confirm(\'Are you sure you want to erase all entries in the database and start scanning again?\');">'; echo '</form>'; The $text variable is a static var which has alrdy been set so I dont need the above within a form, i just need it to run when an upload is carried out. (So I can just set the action of the upload form to run the whole script). How can i modify the above to just run those functions without the initialisation of user pressing the button? Thanks in advance Link to comment https://forums.phpfreaks.com/topic/105240-solved-running-this-function-without-a-form/ Share on other sites More sharing options...
GingerRobot Posted May 12, 2008 Share Posted May 12, 2008 Well, you could use some javascript to submit the form once the page has loaded, but that seems a bit stupid. You need to address this with the section of code which is executed when the form has been submitted - basically remove the check to see if the form has been submitted, then instead to taking the values from the forms, define them with the values you want. Link to comment https://forums.phpfreaks.com/topic/105240-solved-running-this-function-without-a-form/#findComment-538877 Share on other sites More sharing options...
unknown101 Posted May 12, 2008 Author Share Posted May 12, 2008 Cheers, removed all checks and works great Link to comment https://forums.phpfreaks.com/topic/105240-solved-running-this-function-without-a-form/#findComment-538889 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.