samedi 28 mars 2015

How to Initiate the Submit button function

new guy here. i'm currently developing a form for web scraping activities. may i ask, how do i initiate the submit button function using isset? tried a few methods but to no avail. so sorry if this question seems basic, but i really want to learn the fundamentals in order to proceed with bigger form function in the future. here's my code:



<form id="startWeb" name="startWeb" method="post" action="webcrawlBM_process.php">
<input type="button" id="startCrawl" action="submit" value="Mula Mengikis" class="gradient-background" onClick="submitForm();" style="width: 230px" />


when user click on submit, a javascript function will initiate.



function submitForm(action)
{
document.getElementById('startWeb').action = action;
document.getElementById('startWeb').submit();
alert('Data anda telah disimpan! Anda akan dihalakan kembali ke halaman utama.');
window.location = 'index.php';
}


here's my isset function that is problematic. if (isset($_POST['submit'])) {



$webcrawl = new WebCrawlerBM($_POST['target_url']);

if ($webcrawl->WebCrawlerBM($_POST['target_url'])) {
if ($webcrawl->submitForm()) {
$webcrawl->set_webpage($url);
$webcrawl->set_makefile($text);
$webcrawl->set_writefile($filename);
$webcrawl->set_striphtmltags($text);

echo "Your action had been completed successfully. <br>";

}


can anyone give me a guidance on this? been stuck on this error for a while. the situation now is that when i clicked, nothing happened. please, kind guidance is appreciated.


Aucun commentaire:

Enregistrer un commentaire