473,480 Members | 1,995 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

variable as input value with PHP / MySQL

I created a form page with HTTP Authentication that works with a MySQL
backend. In addition to a username and
password, there is a 3rd field tied to each entry. For example:

username: 1111
password: 2222
firstname: John

So, when the user enters the u and p, the name 'John' will show up as an
input value in a form that will be submitted.

$sql = "SELECT * FROM login WHERE
username = '$PHP_AUTH_USER' AND
password = '$PHP_AUTH_PW'";

$result = mysql_query( $sql )
or die ( 'Unable to execute query.' );
$s = mysql_fetch_array($result);

THEN

<input name="firstname" type="hidden" value="<? echo("$s[firstname]\n");
?>">
<? print("$s[firstname]\n"); ?>
Strange thing is, the admin output page I made to read this works in
Firefox, Safari, and Netscape. But, when I submit the form and look at
the output page in Internet Explorer....I get a blank page (even though
the data shows in the table). When, I changed the value to a
non-variable, then it works in IE. So, how do you think I can change
this to work with IE since most of our users use this.
Aug 8 '05 #1
2 3816
Jeff <sw*****@NOSPAMcomcast.net> wrote:
...
So, when the user enters the u and p, the name 'John' will show up as an
input value in a form that will be submitted.

$sql = "SELECT * FROM login WHERE
username = '$PHP_AUTH_USER' AND
password = '$PHP_AUTH_PW'";

$result = mysql_query( $sql )
or die ( 'Unable to execute query.' );
$s = mysql_fetch_array($result);

THEN

<input name="firstname" type="hidden" value="<? echo("$s[firstname]\n");
?>">
<? print("$s[firstname]\n"); ?>

Strange thing is, the admin output page I made to read this works in
Firefox, Safari, and Netscape. But, when I submit the form and look at
the output page in Internet Explorer....I get a blank page (even though
the data shows in the table). When, I changed the value to a
non-variable, then it works in IE. So, how do you think I can change
this to work with IE since most of our users use this.


There's nothing wrong with this code. You need to show us the rest of the
HTML (including the <form> header) and the PHP code that creates the
response. The problem is almost certainly much later than what you've
shown us here
--
- Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
Aug 9 '05 #2
Tim Roberts wrote

There's nothing wrong with this code. You need to show us the rest of the
HTML (including the <form> header) and the PHP code that creates the
response. The problem is almost certainly much later than what you've
shown us here


I found the solution. Thanks though.
I changed:

<input name="firstname" type="hidden" value="<? echo("$s[firstname]\n");
?>"><? print("$s[firstname]\n"); ?>

TO:

<input name="firstname" type="hidden" value="<?php print
$s['firstname']; ?>"><?php print $s['firstname']; ?>

Aug 9 '05 #3

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

Similar topics

1
1453
by: Philippe Rousselot | last post by:
Hi, On a page, I have a form with a variable number of fields. to print these fields, I have such a code : while ($i !=0){ echo '<td> <input type="text" name="component'.$i.'" size="20"...
4
1337
by: danny | last post by:
Hi, I need some help regarding variable passing in php. I have a script which writes the current form text box values to an email script which works correctly. Should I use a variable which was...
4
2268
by: Carramba | last post by:
hi! I have simple form like <form method="POST" action="create_db.php"> db name: <input type="text" name="db" size="20"> <br> table name: <input type="text" name="table" size="20"> <br>...
1
2495
by: Dominik Szczurek | last post by:
Hello to anyone who is tring to help me :-) As I was writed in the topic I have problem when somone input 0 value in the form. PHP is losting this value when it try to write it to mySQL. I have...
5
2256
by: strawberry | last post by:
In the function below, I'd like to extend the scope of the $table variable such that, once assigned it would become available to other parts of the function. I thought 'global $table;' would solve...
2
5234
by: Boujii | last post by:
Greetings, I have been attempting to make a drop down menu of countries. From this menu I wish to create a variable in order to INPUT into mysql database. I have no trouble making the drop down menu,...
2
15483
by: assgar | last post by:
I am having problems getting the user selected form info to inserted into the mysql database. I am also rec eving an error: Warning: Variable passed to each() is not an array or object in ...
4
2301
by: jej1216 | last post by:
I'm pretty new to PHP and MySQL. I have managed to create a form that inserts data to MySQL and to create a form to search the DB. Now here is my problem. I am unsuccessful coding a hidden...
10
2982
by: Mason Barge | last post by:
I have a standard POST form consisting of two types of input: text input and textarea. The form downloads current settings from a mysql database. The user can update the information by modifying...
0
7051
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
6915
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...
1
6750
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
6993
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
3003
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
2993
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1307
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
567
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
193
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.