473,492 Members | 4,279 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Need to tab through a form

18 New Member
Quick (and hopefully easy) question . . .
I’m trying to figure out where in the following php code to place the tabindex number. What the code does is show the already selected answer that has been saved to a MySql table. I have other fields before and after and would like to be able to tab through them all.
I’ve tried different places but keep getting this error - Parse error: syntax error, unexpected T_LNUMBER, expecting ',' or ';'
Hope someone can help me out.
Thanks

[PHP]
<?php
// the list in PHP terms (in an array)
$dropDownList = array (
"",
"Yes",
"No",
);

// grab data from database
$result = mysql_query("SELECT `myfield` FROM `MYTABLE` WHERE ID='{$_SESSION['ID']}'");

// put data into an array
$dataArray = mysql_fetch_array($result);

// now output
echo "<select name=\"myfield\">\n";

foreach($dropDownList as $listItem)
{
// output <option> for this item in the list

// if this item matches DB value, then we put in SELECTED.
if ($dataArray[0] == $listItem)
{
echo "<option value=\"{$listItem}\" SELECTED>{$listItem}</option>\n";
}
// otherwise, just output it normally
else
{
echo "<option value=\"{$listItem}\">{$listItem}</option>\n";
}
}

echo "</select>";

?>[/PHP]
Feb 6 '08 #1
5 1231
Markus
6,050 Recognized Expert Expert
Can you show the code that gives you the error?
Feb 6 '08 #2
help4me
18 New Member
I'm putting [HTML]tabindex="5"[/HTML]. This drop down is the 5th field in the tab order.
Feb 7 '08 #3
Markus
6,050 Recognized Expert Expert
I'm putting [HTML]tabindex="5"[/HTML]. This drop down is the 5th field in the tab order.
And you putting that in the select?
Expand|Select|Wrap|Line Numbers
  1. <select name=\"name\" tabindex=\"5\">
  2.  
?
Feb 7 '08 #4
help4me
18 New Member
I am now!!! :) I forgot about using "\". Thanks so much!
Feb 7 '08 #5
Markus
6,050 Recognized Expert Expert
I am now!!! :) I forgot about using "\". Thanks so much!
No problem, friend.

The silliest mistakes happen to the best of 'em!

Markusn000bz.
Feb 7 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

7
1865
by: Rodney King | last post by:
Hi, I have developed an ASP page which dynamically displays a list of checkbox options based on a SQL statement. Here is my code: <div style="OVERFLOW:auto; Height: 150px"> <table> <% dim...
5
1856
by: cmc_dermo | last post by:
I have a form that has a select list. A user chooses a value and the page refreshes showing the selected value in the dropdown box. So I want to use Javascript to get the selected query from...
5
8393
by: rjames.clarke | last post by:
I have the following. $result=mysql_query($sql); $nrows=mysql_num_rows($result); for ($i=0;$i<$nrows;$i++) { $row_array=mysql_fetch_row($result); echo "<form name='testform'...
19
4064
by: James Fortune | last post by:
I have a lot of respect for David Fenton and Allen Browne, but I don't understand why people who know how to write code to completely replace a front end do not write something that will automate...
3
10604
by: google | last post by:
I have a database with four table. In one of the tables, I use about five lookup fields to get populate their dropdown list. I have read that lookup fields are really bad and may cause problems...
10
2847
by: Tom | last post by:
I am looking for some ideas for how to design the layout of the form for data entry and to display the data for the following situation: There are many sales associates. A sales associate can work...
4
1408
by: Bob | last post by:
Hallo, I have to make a web application in Javascript/ASP for tenniscourt reservation (based on Access database). I would like to do everything with one page, because the user must be able to...
0
2234
by: ward | last post by:
Greetings. Ok, I admit it, I bit off a bit more than I can chew. I need to complete this "Generate Report" page for my employer and I'm a little over my head. I could use some additional...
8
3694
by: | last post by:
The problem lies here eval("document.TeeForm.amt.value(S+M)"); S and M suppose to add up and the total suppose to appear on the AMT field but it didn't. Any help? ...
9
2171
by: MrHelpMe | last post by:
Hello again experts, I have successfully pulled data from an LDAP server and now what I want to do is drop the data into a database table. The following is my code that will insert the data but...
0
7118
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6980
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7157
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
5452
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4886
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3078
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1397
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
637
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
282
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.