The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> using a form with a select control
tudsy
post Aug 25 2016, 09:52 PM
Post #1


Advanced Member
****

Group: Members
Posts: 166
Joined: 30-September 14
Member No.: 21,611



Hi


I am now using a form with a select control. I am having trouble putting something in the action attribute of the form. The code presents the user with a
drop down menu and when the user selects the option he/she wants, the graphic and sound byte is updated. Its not working properly.

Attached is the full code.

Thanks in anticipation.


Attached File(s)
Attached File  code.txt ( 6.91k ) Number of downloads: 272
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
CharlesEF
post Aug 25 2016, 11:51 PM
Post #2


Programming Fanatic
********

Group: Members
Posts: 1,583
Joined: 27-April 13
From: Edinburg, Texas
Member No.: 19,088



You seem to be making this harder on yourself then it needs to be.

First, all your pages should use a doctype statement. A doctype ensures that a browser will render your page the same regardless of which OS or browser the user is using. The lack of a doctype will cause the browser to display the page in quirks mode, which means different browsers will render the page differently. If you want to use the HTML5 specs then you should use <!DOCTYPE html> before the <html> line. As shown here.

Second, you seem to be missing the purpose of double quotes in PHP. Example, you have written:
CODE
foreach(glob("/home/ecovibdc/public_html/ECOVIB2D/MYART/".$pname."/Graphicw/*.bmp") as $files1){
When you could have written it this way:
CODE
foreach(glob("/home/ecovibdc/public_html/ECOVIB2D/MYART/$pname/Graphicw/*.bmp") as $files1){
You see PHP will substitute $pname with the actual value when enclosed with double quotes.

Third, this line of code is still wrong:
CODE
$options= '<option value='.$files1.'>'.$files1.'</option>';
Did you read my reply in the other thread you posted about this same problem? BTW, you should have continued in the other thread instead of starting a new one. And you should reply to people who have taken the time to reply to you. When you echo $options the line will look like this:
CODE
<option value=valueof$files1>valueof$files1</option>
Notice how there are still no quotes around the value attribute? That is invalid HTML. It should be written as:
CODE
$options= "<option value='$files1'>$files1</option>";
for single quotes around the value attribute OR this:
CODE
$options= "<option value=\"$files1\">$files1</option>";
for double quotes around the value attribute.

To be honest, you should code most of the form directly, no need to echo so much. Only use PHP echos in the places you need to, like the <option>'s section.

This post has been edited by CharlesEF: Aug 25 2016, 11:55 PM
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 22nd March 2019 - 09:26 AM