MarioPro
09-05-2005, 02:39 PM
I can't get the values from Keywords selected to my query after hitting the Save button. I've tried lots of different approaches and can't find where the problem is :o
Thanks in advance for any help on this issue.
Here's the page code where after submitting the form the script should display the KEYWORDS entered to the left select list.
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript">
function move(fbox, tbox) {
var arrFbox = new Array();
var arrTbox = new Array();
var arrLookup = new Array();
var i;
for(i=0; i<tbox.options.length; i++) {
arrLookup[tbox.options[i].text] = tbox.options[i].value;
arrTbox[i] = tbox.options[i].text;
}
var fLength = 0;
var tLength = arrTbox.length
for(i=0; i<fbox.options.length; i++) {
arrLookup[fbox.options[i].text] = fbox.options[i].value;
if(fbox.options[i].selected && fbox.options[i].value != "") {
arrTbox[tLength] = fbox.options[i].text;
tLength++;
} else {
arrFbox[fLength] = fbox.options[i].text;
fLength++;
}
}
arrFbox.sort();
arrTbox.sort();
fbox.length = 0;
tbox.length = 0;
var c;
for(c=0; c<arrFbox.length; c++) {
var no = new Option();
no.value = arrLookup[arrFbox[c]];
no.text = arrFbox[c];
fbox[c] = no;
}
for(c=0; c<arrTbox.length; c++) {
var no = new Option();
no.value = arrLookup[arrTbox[c]];
no.text = arrTbox[c];
tbox[c] = no;
}
}
function selectAll(box) {
for(var i=0; i<box.length; i++) {
box[i].selected = true;
}
}
</script>
</head>
<body>
<p>
<?
if($save=Save){
echo $keywords;
}
?>
</p>
<form method="post" action="photoedit.php?save=Save" name="editphoto" enctype="multipart/form-data">
<table border="0" cellpadding="2" cellspacing="1" id="sqlcontainer" name="sqlcontainer">
<tr>
<td align="center" bgcolor="#dbe7f9">photo_title_en</td>
<td align="center" bgcolor="#dbe7f9" nowrap="nowrap"> varchar(255) </td>
<td bgcolor="#dbe7f9"><input type="text" name="photo_title_en" value="" size="40" maxlength="255">
</td>
<td bgcolor="#dbe7f9"> </td>
<td bgcolor="#dbe7f9"> </td>
</tr>
<tr>
<td align="center" bgcolor="#e6f0ff">photo_keywords</td>
<td align="center" bgcolor="#e6f0ff" nowrap="nowrap">text</td>
<td align="right" bgcolor="#e6f0ff"><select multiple size="10" name="keywords[]" id="keywords" style="width:150" onDblClick="move(this.form.keywords,this.form.keyword_pad)">
</select>
</td>
<td bgcolor="#e6f0ff"><input type="button" onClick="move(this.form.keywords,this.form.keyword_pad)" value=">>" id=button1 name=button1>
<input type="button" onClick="move(this.form.keyword_pad,this.form.keywords)" value="<<" id=button2 name=button2>
</td>
<td bgcolor="#e6f0ff"><select name="keyword_pad" id="keyword_pad" size="10" multiple="multiple" onDblClick="move(this.form.keyword_pad,this.form.keywords)">
<option value="Couple, ">Couple</option>
<option value="Child, ">Child</option>
<option value="Man, ">Man</option>
<option value="Two, ">Two</option>
<option value="Female, ">Female</option>
<option value="Young, ">Young</option>
</select>
</td>
</tr>
</table>
<br >
<input name="submit" type="submit" tabindex="119" value="Save">
</form>
</body>
</script>
</html>
Thanks in advance for any help on this issue.
Here's the page code where after submitting the form the script should display the KEYWORDS entered to the left select list.
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript">
function move(fbox, tbox) {
var arrFbox = new Array();
var arrTbox = new Array();
var arrLookup = new Array();
var i;
for(i=0; i<tbox.options.length; i++) {
arrLookup[tbox.options[i].text] = tbox.options[i].value;
arrTbox[i] = tbox.options[i].text;
}
var fLength = 0;
var tLength = arrTbox.length
for(i=0; i<fbox.options.length; i++) {
arrLookup[fbox.options[i].text] = fbox.options[i].value;
if(fbox.options[i].selected && fbox.options[i].value != "") {
arrTbox[tLength] = fbox.options[i].text;
tLength++;
} else {
arrFbox[fLength] = fbox.options[i].text;
fLength++;
}
}
arrFbox.sort();
arrTbox.sort();
fbox.length = 0;
tbox.length = 0;
var c;
for(c=0; c<arrFbox.length; c++) {
var no = new Option();
no.value = arrLookup[arrFbox[c]];
no.text = arrFbox[c];
fbox[c] = no;
}
for(c=0; c<arrTbox.length; c++) {
var no = new Option();
no.value = arrLookup[arrTbox[c]];
no.text = arrTbox[c];
tbox[c] = no;
}
}
function selectAll(box) {
for(var i=0; i<box.length; i++) {
box[i].selected = true;
}
}
</script>
</head>
<body>
<p>
<?
if($save=Save){
echo $keywords;
}
?>
</p>
<form method="post" action="photoedit.php?save=Save" name="editphoto" enctype="multipart/form-data">
<table border="0" cellpadding="2" cellspacing="1" id="sqlcontainer" name="sqlcontainer">
<tr>
<td align="center" bgcolor="#dbe7f9">photo_title_en</td>
<td align="center" bgcolor="#dbe7f9" nowrap="nowrap"> varchar(255) </td>
<td bgcolor="#dbe7f9"><input type="text" name="photo_title_en" value="" size="40" maxlength="255">
</td>
<td bgcolor="#dbe7f9"> </td>
<td bgcolor="#dbe7f9"> </td>
</tr>
<tr>
<td align="center" bgcolor="#e6f0ff">photo_keywords</td>
<td align="center" bgcolor="#e6f0ff" nowrap="nowrap">text</td>
<td align="right" bgcolor="#e6f0ff"><select multiple size="10" name="keywords[]" id="keywords" style="width:150" onDblClick="move(this.form.keywords,this.form.keyword_pad)">
</select>
</td>
<td bgcolor="#e6f0ff"><input type="button" onClick="move(this.form.keywords,this.form.keyword_pad)" value=">>" id=button1 name=button1>
<input type="button" onClick="move(this.form.keyword_pad,this.form.keywords)" value="<<" id=button2 name=button2>
</td>
<td bgcolor="#e6f0ff"><select name="keyword_pad" id="keyword_pad" size="10" multiple="multiple" onDblClick="move(this.form.keyword_pad,this.form.keywords)">
<option value="Couple, ">Couple</option>
<option value="Child, ">Child</option>
<option value="Man, ">Man</option>
<option value="Two, ">Two</option>
<option value="Female, ">Female</option>
<option value="Young, ">Young</option>
</select>
</td>
</tr>
</table>
<br >
<input name="submit" type="submit" tabindex="119" value="Save">
</form>
</body>
</script>
</html>