Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
data from database into a form
Old 05-21-2009, 12:45 PM data from database into a form
millwalll's Avatar
Webmaster Talker

Posts: 674
Name: James
Location: KENT
Trades: 3
Hi all I have a table that has price code,descripion and price and I have a web page that has a form with ID, what is a drop down box. Price, what is a text field and description what is a text field.

What I want to do is have the ID on the form get the price code vales and disaply then in the drop down box.

So when the user select a number from the drop down box it will load the price and description that relates to it.

For exmaple select 1 it will loads the price and description from the price code that has the value 1 one.

The user can then edit the price and description and save them back to the database.

any help be amazing guys/girls

I need more help on other issues but doing things one step at a time thanks in advance
__________________

Please login or register to view this content. Registration is FREE
millwalll is offline
Reply With Quote
View Public Profile Visit millwalll's homepage!
 
 
Register now for full access!
Old 05-21-2009, 02:37 PM Re: data from database into a form
Skilled Talker

Posts: 87
Trades: 0
Um... you can't really expect help when you have nothing to work with. Go to a php tutorial and read up on databases, extracting information from databases, and then displaying those on your page. Then read about how to get information from a page (you would probably want to use $_POST), and then how to save that back into a database.

Basically, your question does not deserve an answer. Go do some reading first.
__________________

Please login or register to view this content. Registration is FREE
- The most comprehensive online resource for students and educators.
yuechen is offline
Reply With Quote
View Public Profile Visit yuechen's homepage!
 
Old 05-21-2009, 02:52 PM Re: data from database into a form
millwalll's Avatar
Webmaster Talker

Posts: 674
Name: James
Location: KENT
Trades: 3
I have kinder been doing that and messing about with the cod ethis is what I have so far can someone tell me if I working in right direction.

Code:
<?php

$db = mysql_connect();
$result = mysql_select_db("m08jpr23", $db);

$query = "select price_code from price;";		
$result = mysql_query($query,$db);
$nrows = mysql_num_rows($result);
//$row=0;
//while($row < $nrows)
//{  
 $price_code = mysql_result($result,$row,"price_code");
  echo "<select><option>$price_code</option></select>"; 
	//$row++;
//}
mysql_free_result($result);
mysql_close($db);
?>
What is kinder working just finding it hard to get the $price-code to disaply all result into a drop down menu and then linking this to the other fields

thanks
__________________

Please login or register to view this content. Registration is FREE
millwalll is offline
Reply With Quote
View Public Profile Visit millwalll's homepage!
 
Old 05-21-2009, 05:50 PM Re: data from database into a form
Novice Talker

Posts: 5
Trades: 0
Ok..your code is not working properly. I am going to correct your code.

<?php

$db = mysql_connect('your_localhost', 'your_mysql_user', 'your_mysql_password');
$result = mysql_select_db("m08jpr23", $db);

$query = "select price_code from price;";
$result = mysql_query($query,$db);
//$row=0;
while($nrows = mysql_fetch_row($result))
{
$price_code = $nrows[0];
echo "<select><option>$price_code</option></select>";
$row++;
}
mysql_free_result($result);
mysql_close($db);
?>

Last edited by aofrozen; 05-21-2009 at 05:51 PM..
aofrozen is offline
Reply With Quote
View Public Profile
 
Old 05-21-2009, 06:36 PM Re: data from database into a form
millwalll's Avatar
Webmaster Talker

Posts: 674
Name: James
Location: KENT
Trades: 3
Quote:
Originally Posted by aofrozen View Post
Ok..your code is not working properly. I am going to correct your code.

<?php

$db = mysql_connect('your_localhost', 'your_mysql_user', 'your_mysql_password');
$result = mysql_select_db("m08jpr23", $db);

$query = "select price_code from price;";
$result = mysql_query($query,$db);
//$row=0;
while($nrows = mysql_fetch_row($result))
{
$price_code = $nrows[0];
echo "<select><option>$price_code</option></select>";
$row++;
}
mysql_free_result($result);
mysql_close($db);
?>
Hi thanks will try that
__________________

Please login or register to view this content. Registration is FREE
millwalll is offline
Reply With Quote
View Public Profile Visit millwalll's homepage!
 
Reply     « Reply to data from database into a form
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.22457 seconds with 12 queries