How to Update this? PHP.
Posted: Mon Mar 12, 2012 12:40 am
Hi there! I'm newbie in part of PHP. Here is my code.
Here is the code for my update php
When you pick one in the list of company name the price of their service will be fetch in the textbox and I want that price to edit but unfortunately I can't update it. Any help will much appreciated within bottom of my heart. Cheers!
Regards,
Code: Select all
<?php
include("config.php");
$sql = "SELECT * FROM customers ORDER BY CompanyName ASC";
$result = mysql_query($sql);
?>
<form name="form" method="post" action="join.php">
<select name="myOptions" onchange="document.form.price.value=this.value">
<option value>----Choose Company Name----</option>
<?php
while ($rows=mysql_fetch_array($result))
{
?>
<option value="<?php echo $rows['Price']?>"><?php echo $rows['CompanyName'] ?></option>
<?php
}
?>
</select>
<input type="text" name="price"><br>
<input type="submit" name="submit" value="Submit"/>
</form>
Code: Select all
<?php
include ("config.php");
$price=$_POST['price'];
$sql="UPDATE customers WHERE Price = '$price'";
$query=mysql_query($sql);
?>When you pick one in the list of company name the price of their service will be fetch in the textbox and I want that price to edit but unfortunately I can't update it. Any help will much appreciated within bottom of my heart. Cheers!
Regards,