...

View Full Version : Help.Set table raw based on dropbox value



geoma007
08-02-2011, 09:50 PM
Hello, i got a problem. I have a form with a drop box which take values from db table, now i want when the submit button pressed a raw of characters table based on box value copied to another table. here is the code.

form:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script src="js/jquery-1.3.2.min.js" type="text/javascript"></script>
<script src="js/fns.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="css/form/view.css" media="all">
<script type="text/javascript" src="css/form/view.js"></script>
<script src="includes/jquery-1.2.6.min.js" type="text/javascript" charset="utf-8"></script>
<script src="includes/jquery.form.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">

$(document).ready(function() {
$('#form_222202').ajaxForm({
target: '#error',
success: function() {
$('#error').fadeIn('slow');
}
});
});

</script>
<style>
label.error { width: 250px; display: inline; color: red;}
</style>
</head>
<body id="main_body" >


<div id="form_container">


<form id="form_222202" class="appnitro" method="post" action="getuser.php">

<ul >

<li id="li_1" >
<label class="description" for="element_1">Choose your
victims </label>
<div>
<?php
include("library/config.php");
$sql = "SELECT charactername FROM characters";
$result = mysql_query($sql);
?>
<select class="element select medium" id="element_1" name="element_1" onchange="submit()">
<?php
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
?>
<option value="<?php echo $line['charactername'];?>"> <?php echo $line['charactername'];?> </option>

<?php
}
?>

</select>
</div>
</li>

<li class="buttons">
<input type="hidden" name="form_id" value="222202" />

<input id="saveForm" class="button_text" type="submit" name="submit" value="Submit" />
</li>
</ul>
</form>

</div>

</body>
</html>


and her is getuser.php :


<?php

$value = $_POST["element_1"];
include("library/config.php");

$sql="INSERT INTO playnow SELECT image FROM characters WHERE charactername="$value" ";

$result = mysql_query($sql);
echo '.$value.';


?>


can anyone help me?:confused:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum