473,224 Members | 1,574 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,224 software developers and data experts.

Passing Data To Multi Use Form

I am working on a site where I need to create forms to both add and edit
information for a group of products. I would like to use the same form for
both adding new and edit data for existing products, while at the same time
separating data and presentation functions. So when the user selects the
option to add a new product, the form comes up with all drop down lists
filled from the database with the options for that field and all other
fields blank, and when a product is selected to be edited, I would like the
same form to come up, but this time with all the fields filled in, including
all drop down lists filled with the appropriate value for that product.

In the past, I've done something like this to fill drop down lists with the
valid options:

function add_product_form()
<div name="add_new_product" align="center">
<h3>Add New Product</h3>
<form name="add_product" method="get" action="add_product.php">
<select name="category">
if (db_connect()) //sets up conenction to database
$query = "select * from category";
$result = mysql_query($query) or die(mysql_error());

while($row = mysql_fetch_array($result))
$id = $row['category_sku'];
$name = $row['category_name'];
<option value=<?php echo $id ?>><?php echo $name ?></option>
echo("Error connecting to host");

This snippet just shows one drop down list being created and filled with the
options. So how can I create a form to use for both adding new and editing
existing products, and only fill in the data if it is editing? If there is
an OO way to do this, that would be great. One idea I have is to pass a
variable that is set to either "new" or edit", and do something based on
that, but what I'm unsure about is how to pass the edited data to the form
from the function that gets it from the database.


Jul 17 '05 #1
0 1305

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: Hamed | last post by:
Hello I have employed as a developer in a software company that its team uses FoxPro / VB 6.0 / VC++ 6.0 as the developing tools and newly is going to migrate to VS.NET. There is a project...
by: Curtis Justus | last post by:
Hi, I currently have a control that is on a form and I want to pass that exact instance of the control to another form (a child form that appears on a button click). The control has state,...
by: Johnny | last post by:
I'm a rookie at C# and OO so please don't laugh! I have a form (fclsTaxCalculator) that contains a text box (tboxZipCode) containing a zip code. The user can enter a zip code in the text box and...
by: SQLScott | last post by:
I have looked all over and I cannot find an example or information on passing a multi-dimensional array. Well, that is not true. I found a close example in C++ but it didn't work when I...
by: Mark Denardo | last post by:
Hi, I have multi-threaded application that requires one particular thread (Non-Form based) to receive data from other threads. I know how to pass control to Form Threads, but I believe there's no...
by: entitledX | last post by:
Hi, I'm trying to use the HDF library to read a few HDF files that I need to process. The data in each file varies in rows, but the columns remain constant. Because of that, I had dynamically...
by: jej1216 | last post by:
I am trying to put together a PHP search page in which the user can select none, one, two, or three fields to search, and then the results php will build the SQL with dynamic where caluses to reflect...
by: John | last post by:
Hello All, Can someone help me with a problem I am having? I have a form which has a multi-select list where the user can select more than one company name from a list and I need to pass those...
by: Tom | last post by:
Hello all, Is there a method to fill out a web form and click the submit button in vb.net? I'm attempting to programmtically submit raw GPS data to http://www.ngs.noaa.gov/OPUS/ for...
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.