choosing dropdown from another table
Forum rules
PLEASE READ THE FORUM RULES BEFORE YOU POST:
viewtopic.php?f=12&t=1901
MUST READ:
http://www.wysiwygwebbuilder.com/forms.html
http://www.wysiwygwebbuilder.com/form_wizard.html
Frequently Asked Questions about Forms
PLEASE READ THE FORUM RULES BEFORE YOU POST:
viewtopic.php?f=12&t=1901
MUST READ:
http://www.wysiwygwebbuilder.com/forms.html
http://www.wysiwygwebbuilder.com/form_wizard.html
Frequently Asked Questions about Forms
choosing dropdown from another table
Hi, when creating a form for updating a database, is it possible that the dropdown can be fields from another table?
For example, a "customer details" table form, need to choose the customer account manager from the "staff" table?
Thanks
For example, a "customer details" table form, need to choose the customer account manager from the "staff" table?
Thanks
-
-
- Posts: 1439
- Joined: Fri Aug 21, 2020 8:27 am
- Contact:
Re: choosing dropdown from another table
As it is database related stuff your question is not clear enough to understand. Please write in a better detail so all can understand. But the way I see it may require custom codes.
Re: choosing dropdown from another table
Thanks, I thought it would need custom code, I just need to know if it is possible, and where to put the custom code.
So I want to create a form (I already have the database) for updating customer details, the form will show customer name, address, phone etc. The form also needs to show who is the customer's account manager. I have a list of account managers already in a table called "staff".
I need the form, for updating customer, in the Account Manager field, to be a dropdown and the choices in the dropdown need to come from the name of the staff in the "staff" table on the database, does this make sense? Thank you
So I want to create a form (I already have the database) for updating customer details, the form will show customer name, address, phone etc. The form also needs to show who is the customer's account manager. I have a list of account managers already in a table called "staff".
I need the form, for updating customer, in the Account Manager field, to be a dropdown and the choices in the dropdown need to come from the name of the staff in the "staff" table on the database, does this make sense? Thank you
-
-
- Posts: 1439
- Joined: Fri Aug 21, 2020 8:27 am
- Contact:
Re: choosing dropdown from another table
I think you need to create a table in your MYSQL DATABASE which has informations of CUSTOMER DETAILS and also has the information about ACCOUNTS MANAGERS from the table called STAFF to combine and make 1 table in database out of it and use MYSQL CRUD to do the editing.krwysi wrote: ↑Sun Feb 25, 2024 4:27 pm Thanks, I thought it would need custom code, I just need to know if it is possible, and where to put the custom code.
So I want to create a form (I already have the database) for updating customer details, the form will show customer name, address, phone etc. The form also needs to show who is the customer's account manager. I have a list of account managers already in a table called "staff".
I need the form, for updating customer, in the Account Manager field, to be a dropdown and the choices in the dropdown need to come from the name of the staff in the "staff" table on the database, does this make sense? Thank you
It is more like a relation table which has foreign included but not a primary though but relationary.
Re: choosing dropdown from another table
Thank you for the reply.
I need a little advice about which extension(s) would be best to achieve what I need below (I have all of them).
I would like the user to be able to view a data table, showing all the records, and be able to click to view, edit, delete etc.. but when editing or viewing, the form needs to have the option to upload a file, and also, one of the fields in the table is an image.
As per previously one of the fields is also a dropdown choice from another table, and I guess I need to input the custom php somewhere in this after I have configured it via mysql.
I don't know if the mysql crud tool has this ability?
Is it possible to use the mysql crud with a custom form for the updating/viewing of records?
Thanks in advance.
I need a little advice about which extension(s) would be best to achieve what I need below (I have all of them).
I would like the user to be able to view a data table, showing all the records, and be able to click to view, edit, delete etc.. but when editing or viewing, the form needs to have the option to upload a file, and also, one of the fields in the table is an image.
As per previously one of the fields is also a dropdown choice from another table, and I guess I need to input the custom php somewhere in this after I have configured it via mysql.
I don't know if the mysql crud tool has this ability?
Is it possible to use the mysql crud with a custom form for the updating/viewing of records?
Thanks in advance.
Re: choosing dropdown from another table
There is no standard solution for this because this is very specific. So, this will require a custom script.
Re: choosing dropdown from another table
Thanks Pablo.
Is it possible I can design the layout of my table using wwb and implement a script something like the below for functionality? (not asking how to do it, just asking if possible!!)
<?php
// Database connection
$servername = "localhost";
$username = "username";
$password = "password";
$dbname = "database";
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// Fetch data from the database table
$sql = "SELECT * FROM table_name";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// Output data of each row
while($row = $result->fetch_assoc()) {
echo "ID: " . $row["id"]. " - Name: " . $row["name"]. " - <a href='edit.php?id=" . $row["id"] . "'>Edit</a> - <a href='view.php?id=" . $row["id"] . "'>View</a> - <a href='delete.php?id=" . $row["id"] . "'>Delete</a><br>";
}
} else {
echo "0 results";
}
$conn->close();
?>
Is it possible I can design the layout of my table using wwb and implement a script something like the below for functionality? (not asking how to do it, just asking if possible!!)
<?php
// Database connection
$servername = "localhost";
$username = "username";
$password = "password";
$dbname = "database";
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// Fetch data from the database table
$sql = "SELECT * FROM table_name";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// Output data of each row
while($row = $result->fetch_assoc()) {
echo "ID: " . $row["id"]. " - Name: " . $row["name"]. " - <a href='edit.php?id=" . $row["id"] . "'>Edit</a> - <a href='view.php?id=" . $row["id"] . "'>View</a> - <a href='delete.php?id=" . $row["id"] . "'>Delete</a><br>";
}
} else {
echo "0 results";
}
$conn->close();
?>
-
-
- Posts: 1439
- Joined: Fri Aug 21, 2020 8:27 am
- Contact:
Re: choosing dropdown from another table
PHP table generates dynamically by taking table data and loading it while wwb Table and buttons are static to the page unless some kind of backend is connected. I am not sure what you meant but if you are trying to make the table or crud kind of thing then it has to be done purely out of the box because it is in a way dynamic data being loaded from the database according to my justification.
No you can not design the layout of your table by dragging and dropping wwb elements that means the full html and the php backend code has to be created with custom written codes and you can not drag and drop wwb buttons or tables to create the mysql crud.Is it possible I can design the layout of my table using wwb and implement a script something like the below for functionality?
Re: choosing dropdown from another table
Thanks, I was trying to shortcut generating the css styling by designing the layout in wwb and using custom script for the table.
No shortcuts for me then
No shortcuts for me then
-
-
- Posts: 1439
- Joined: Fri Aug 21, 2020 8:27 am
- Contact:
Re: choosing dropdown from another table
Understandable. The thing is that php pages are done server sided. So nothing exists until the server generates the html because inside the html there are php codes too and in wwb the tools it has the html is already predefined and written you can not just insert a php code anywhere you want although there are before after options but sometimes may need more than that. That is the reason it would be needed to create it custom.
Re: choosing dropdown from another table
Thank you, I understand it more now.
Back to the drawing board!!
Back to the drawing board!!