Copy link to clipboard
Copied
How do I capture the selection has made in a listbox (PHP code)?
Also:
I am hoping for some guidance. I am new to PHP and Dreamweaver and want to build on the tutorials. I am finding that a bit of a challenge. For instance, I want to modify what we have done by simply adding a listbox that contains information pulled dynamically from a database. I just want to know how to capture the user selection!!! How would I go about determining:
1) if I can do this by adding a listbox to my form
2) if I need to do it strictly with PHP code
3) a combination of the two.
My searches on the web have not been enlightening. In virtually every language I have used there is a source for basic information: this is the listbox object, parameters, etc. This is the syntax for accessing the object. I have tried searching for PHP manual, php listbox, etc. The only hits I have gotten were code snippets answering specific questions. I finally pieced together enough to load the listbox dynamically from a dbase. Interestingly most code snippets had lines and lines of code; mine is short but seems to work. Trying to figure out syntax for what I would assume to be a keyword (reserved word) hasn’t been any more informative.
Is there anything online that would directly speak to these points? I posted this question here as I am sure others are in my shoes. I would buy a book but don’t relish trying to survey a 10 foot wide selection of books on a subject that I have no expertise.
It just seems that what I am looking for is so basic that it should be found on the web, especially since this is an open-source language, no?
Copy link to clipboard
Copied
First of all, I don't do php so I can't offer any code solution. The problem you are having appears to be a common one - you are trying to find a specific solution to a problem without having enough background in the fundamentals of php, html and web forms.The best solution would be to forget about the details of your problem and focus on the fundamentals. Once you understand the basics you'll find that the solution is simple.
> I finally pieced together enough to load the listbox dynamically from a dbase.
I assume that this listbox exists inside a form that the visitor will submit. If that's the case, there isn't anything else you need to do on that page. The script that processes the form should read the value that the visitor selected in the listbox and update the record accordingly. If you are using a different workflow, you will need to describe that.
>It just seems that what I am looking for is so basic that it should be found on the web,
I'm sure it's out there in many places, it just may be hard to search for. The solution you are looking for is all part of how to build dynamic web forms.
Take a look at some of David Powers books on PHP. They come very highly recommended around here and he's a regular on these forums.
Copy link to clipboard
Copied
While it would be the best of all words I don’t have the luxury of learning Dreamweaver, learning PHP, re-learning sql and THEN think building a web site.
What I am attempting to accomplish is only a small step from what the Dreamweaver tutorial already does. I just need to capture the user selection from a listbox I have populated. How big a deal is that?
New to the web, I have programmed on and off since the IBM 360. I have learned plenty of languages using this process but it is not possible without documentation. That is why I’ve ask not just a specific question but also a general question: ‘if you’ve been through this’ question also. I was told this is a good place start so I am trying it.
Most of the PHP books I’ve seen so far just delve right into a complex application and don’t seem to have basic documentation information.
This is an example of what I mean (for another language).
Syntax select <objects>
select <string specifier>
select all [<object type>]
select all from <location> to <location>
Parameters <objects>
A list of one or more objects. You cannot select a book, background, hotword, or viewer.
<string specifier>
A string in a field or record field.
<object type>
A list of one or more objects. You cannot select a book, background, hotword, or viewer.
<location> A list of two numbers in page units, specifying the distance from the left edge and top of the page, respectively. The two points defined by <location> to <location> specify the top left and bottom right corners of a bounding rectangle. Any object completely inside this rectangle is included in the selection.
Description Changes or extends the current selection to include specified objects in the target window. Use the select <objects> form to select individual objects. Only the current page or objects on the current page or background can be selected.
Use the select <string specifier> form to select text in a field or record field. The text that is selected becomes the value of selectedText. Use the select all form to select all objects or all objects of a specific type on either a page or background. To perform a net selection from one location to another location on the page, use the select all from... form.
To deselect objects, set the selection property to null or use the unselect command. To extend a selection, use the extend select command.
Copy link to clipboard
Copied
>While it would be the best of all words I don’t
>have the luxury of learning Dreamweaver , learning PHP
Let's stop there for a second. You say you are new to web developement. Does that mean you don't know HTML and CSS. Learning Dreamweaver without understanding those concepts is going to be frustrating. You will find that once you know HTML and CSS, there is very little about DW that you will need to learn.
You say you don't have the luxory of learning PHP. How much time have you already spent on this one problem? How many more problems do you think you'll encounter? Another thing to realize is that if you are relying on DW's server behaviors, you will quickly realize their limitations. They work fine for really simply stuff, but I have found you can't really build a fully functioning dynamic site with them alone.
>I just need to capture the user selection from a listbox
>I have populated. How big a deal is that?
It's not a big deal at all. Did you read what I said about the workflow of the web form? Does that make sense?
>I have learned plenty of languages using this process but it is not possible without documentation.
What process are you referring to? Learning the language by building a production system?
>Most of the PHP books I’ve seen so far just delve right into a
>complex application and don’t seem to have basic documentation information.
Unfortunately, this is true of many books in that they fail to cover fundamentals. They start right into more complex topics so you really don't fully understand what is going on. As I said before, I don't do php so I can not personally recommend anything. However, I have found that the Head First books are very well organized and easy to power through - especially for an experienced programmer. Spending about 2 hours/day, I'm about halfway through their C# book in about a week.