0

Hi there! I'm newbie in part of PHP. Here is my code.

<?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>

Here is the code for my update php

<?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,

1
Contributor
1
Reply
3
Views
5 Years
Discussion Span
Last Post by jamesaero
0

I found the solution in other forum but still Daniweb rocks! :) Thank you!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.