473,386 Members | 1,828 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,386 software developers and data experts.

Using SELECT

I am developing a form that allows the user to enter data and upon
submission, checks various databases, returns the data to the user so
they can confirm before submission to the database.

Two of the fields are employee names which are retrieved via a call to
the db:

<TD>Assign Rep/Mfg Hours To</TD>
<TD>
<SELECT NAME=arht>
<?
while ($myrow = mysql_fetch_array($emplist1)){
$arht=$myrow['lname'].", ".$myrow['fname'];
echo "<OPTION VALUE=$arht>$arht</OPTION>";
} ?>
</SELECT>
</TD>

As you can see, the field is built by concactinating the lname and
fname fields.

Once the FIRST submission button is clicked, I redisplay the form with
the values the user entered and the returned values from various db
searches that are performed.

I display the above selection by:

<TR>
<TD>Assign Rep/Mfg Hours To</TD>
<TD><INPUT TYPE=TEXT NAME=arht VALUE="<? echo $arht ?>"></TD>
<TD>Est. Project Set Up Time</TD><TD><INPUT TYPE=TEXT NAME=epsut
VALUE="<? echo $epsut ?>"></TD>
</TR>

Only problem is that I only see the 'lname' and the comma. The fname
field is not displayed. I can't seem to find where the problem is or
what I am doing wrong. Anyone see the obvious that I am not?
Thanks

rk

Jul 17 '05 #1
3 1641
redneck_kiwi wrote:
I am developing a form that allows the user to enter data and upon
submission, checks various databases, returns the data to the user so
they can confirm before submission to the database.

Two of the fields are employee names which are retrieved via a call to
the db:

<TD>Assign Rep/Mfg Hours To</TD>
<TD>
<SELECT NAME=arht>
<?
while ($myrow = mysql_fetch_array($emplist1)){
$arht=$myrow['lname'].", ".$myrow['fname'];
echo "<OPTION VALUE=$arht>$arht</OPTION>";
} ?>
</SELECT>
</TD>

As you can see, the field is built by concactinating the lname and
fname fields.

Once the FIRST submission button is clicked, I redisplay the form with
the values the user entered and the returned values from various db
searches that are performed.

I display the above selection by:

<TR>
<TD>Assign Rep/Mfg Hours To</TD>
<TD><INPUT TYPE=TEXT NAME=arht VALUE="<? echo $arht ?>"></TD>
<TD>Est. Project Set Up Time</TD><TD><INPUT TYPE=TEXT NAME=epsut
VALUE="<? echo $epsut ?>"></TD>
</TR>

Only problem is that I only see the 'lname' and the comma. The fname
field is not displayed. I can't seem to find where the problem is or
what I am doing wrong. Anyone see the obvious that I am not?
Thanks


In your first code snippet you haven't quoted $ahrt in
<option value=$ahrt>
Jul 17 '05 #2
redneck_kiwi wrote:
[snip]
<?
while ($myrow = mysql_fetch_array($emplist1)){
$arht=$myrow['lname'].", ".$myrow['fname'];
echo "<OPTION VALUE=$arht>$arht</OPTION>";

echo '<OPTION VALUE="', url_encode($arht), '">',
$arht, '</OPTION>';
or

echo "<OPTION VALUE='$arht'>$arht</OPTION>";
// _________________^_____^___

but I like the first version better :)

} ?>

[snip]

--
USENET would be a better place if everybody read: | to email me: use |
http://www.catb.org/~esr/faqs/smart-questions.html | my name in "To:" |
http://www.netmeister.org/news/learn2quote2.html | header, textonly |
http://www.expita.com/nomime.html | no attachments. |
Jul 17 '05 #3
Thanks! Both work, however using urlencode (you had an underscore) gave
me fname%2C+lname in the input field on the confirmation page. Guess
I'd have to urldecode on the display side to correct that!
Enclosing ('$arht') did the trick though!

Thanks

rk

Jul 17 '05 #4

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

Similar topics

2
by: nanookfan | last post by:
Hi all, I'm having a bizarre problem converting XML files to HTML using an XSLT. The problem is only occuring in my Netscape 7.0 browser. What makes it more bizarre is that it is only...
4
by: Pat Turner | last post by:
Hi, I have some XML like this: <family> <person name="bob"> <father ref="../../person" /> </person> <person name="charlie"> <child ref="../../person" />
10
by: serge | last post by:
Using "SELECT * " is a bad practice even when using a VIEW instead of a table? I have some stored procedures that are identical with the difference of one statement in the WHERE clause. If I...
11
by: Grasshopper | last post by:
Hi, I am automating Access reports to PDF using PDF Writer 6.0. I've created a DTS package to run the reports and schedule a job to run this DTS package. If I PC Anywhere into the server on...
3
by: bloc | last post by:
I am programming an interactive CV using xml, xslt and java script. The page consists of a header which contains links to various 'sections' on the xml cv, a left and right menu, and a central...
8
by: rbg | last post by:
I did use query plans to find out more. ( Please see the thread BELOW) I have a question on this, if someone can help me with that it will be great. In my SQL query that selects data from table,...
1
by: shalini jain | last post by:
Hi, I want to know how can we do pagination using XSL. There are number of tutorials available on pagination using PHP but nothing with XSL. i am really stuck with my code. Below is the code that...
2
by: shivendravikramsingh | last post by:
hi friends, i m using a ajax function for retrieving some values from a database table,and display the values in required field,my prob is that the ajax function i m using is working f9 once,but if...
0
debasisdas
by: debasisdas | last post by:
Using Subqueries ================== The sub query is often referred to as a nested SELECT, Sub - SELECT, or inner SELECT statement. The sub query executes once before the main query. The...
1
debasisdas
by: debasisdas | last post by:
Using Co-related sub query ======================== While a subquery is evaluated only once for each table, a correlated subquery is evaluated once for each row. Sub query can take value from...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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...

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.