Help.
So Far My Script Works Perfect. It is suppose to be a multihost image upload. and my script allows it to add keywords. Alright But Theirs One Problem if more than one image is uploaded the code just repated it self and shows the both images.. So right now if i have
It works fine. But if i upload 2 images
Wont Work. Just submits the first one. Whats the best way to fix this.
Heres the other codes
So Far My Script Works Perfect. It is suppose to be a multihost image upload. and my script allows it to add keywords. Alright But Theirs One Problem if more than one image is uploaded the code just repated it self and shows the both images.. So right now if i have
Code:
<form action="javascript:insert()" method="post">
<input name="keyword" type="text" id="keyword" value=""/>
<input name="name" type="text" id="name" value="<# FILENAME #>"/>
<input type="submit" name="Submit" value="Insert"/>
<div id="insert_response"></div>
It works fine. But if i upload 2 images
Code:
<form action="javascript:insert()" method="post">
<input name="keyword" type="text" id="keyword" value=""/>
<input name="name" type="text" id="name" value="<# FILENAME #>"/>
<input type="submit" name="Submit" value="Insert"/>
<div id="insert_response"></div>
Code:
<form action="javascript:insert()" method="post">
<input name="keyword" type="text" id="keyword" value=""/>
<input name="name" type="text" id="name" value="<# FILENAME #>"/>
<input type="submit" name="Submit" value="Insert"/>
<div id="insert_response"></div>
Wont Work. Just submits the first one. Whats the best way to fix this.
Heres the other codes
Code:
/* ---------------------------- */
/* XMLHTTPRequest Enable */
/* ---------------------------- */
function createObject() {
var request_type;
var browser = navigator.appName;
if(browser == "Microsoft Internet Explorer"){
request_type = new ActiveXObject("Microsoft.XMLHTTP");
}else{
request_type = new XMLHttpRequest();
}
return request_type;
}
var http = createObject();
/* -------------------------- */
/* INSERT */
/* -------------------------- */
/* Required: var nocache is a random number to add to request. This value solve an Internet Explorer cache issue */
var nocache = 0;
function insert() {
// Optional: Show a waiting message in the layer with ID login_response
document.getElementById('insert_response').innerHTML = "Just a second..."
// Required: verify that all fileds is not empty. Use encodeURI() to solve some issues about character encoding.
var keyword= encodeURI(document.getElementById('keyword').value);
var name = encodeURI(document.getElementById('name').value);
// Set te random number to add to URL request
nocache = Math.random();
// Pass the login variables like URL variable
http.open('get', 'insert.php?site_url='+site_url+'&name=' +name+'&nocache = '+nocache);
http.onreadystatechange = insertReply;
http.send(null);
}
function insertReply() {
if(http.readyState == 4){
var response = http.responseText;
// else if login is ok show a message: "Keyword added".
document.getElementById('insert_response').innerHTML = 'Keyword added:'+response;
}
}
Code:
<? require_once "./source/includes/data.php";
if(isset($_GET['keywordl']) && isset($_GET['name'])){
$keyword= $_GET['keyword'];
$name= $_GET['name'];
$insertKeyword_sql = "UPDATE `mmh_file_storage` SET `keyword` = '{$keyword}' WHERE `filename` = '{$name}'";
$insertKeyword= mysql_query($insertKeyword_sql) or die(mysql_error());
echo $keyword;
} else {
echo 'Error! Please fill all fileds!';
}
?>