One more question...
I have pulled my query line by line into my php form. Each line/row will have an input field. How can I dynamically assign a variable to the "name" field, for instance if I want the name= to be the value of the item_no.
My updated code: - <form action="inventorymaster_form.php" method="post" name="inventorymaster_form" align="left" class="style3" bgcolor="#ffffff" onSubmit="return verifyForm(this);">
-
-
<legend>INVENTORYMASTER</legend>
-
<table border="1" class="mainmenu" border="0" cellpadding="0" cellspacing="0">
-
<?php
-
$i=0;
-
while ($i<$num) {
-
$f1=mysql_result($result,$i,"id");
-
$f2=mysql_result($result,$i,"Vendor");
-
$f3=mysql_result($result,$i,"item_no");
-
$f4=mysql_result($result,$i,"description");
-
?>
-
<tr>
-
<td>     <?php echo $f1;?>    </td>
-
<td>     <?php echo $f2;?>    </td>
-
<td>     <?php echo $f3;?>    </td>
-
<td>     <?php echo $f4;?>    </td>
-
<td align="center"> <input type='text' name=$f3 value="<?php echo "$i";?>">
-
-
</tr>
-
<?php
-
$i++;
-
}
-
?>
-
</table>
-
</form>
Thanks again,
MO
5 4839
I am a little confused at what you want. First thing though:
Line 18 has name=$f3
Should be name="<?php echo $f3; ?>" like you ahve for the others.
Second, why don't you include your output (echo) in a loop - like for example in your while loop? Would that be what you want?
yap ,TheServant right . i am adding few more thing
1. echo the php variables in right way
2. space between two var in while condition while ($i < $num)
3. mysql_result() function is slower than mysql_fetch_row(), mysql_fetch_array(), mysql_fetch_assoc() and mysql_fetch_object().
cheers
:)
Atli 5,058
Expert 4TB
Hey.
You can assign array indexes to the name of a input tag.
For example: - <input type='text' name='value[1]' value='first' /><br />
-
<input type='text' name='value[2]' value='second' /><br />
-
<input type='text' name='value[3]' value='third' /><br />
-
<input type='text' name='value[4]' value='fourth' />
Submitted to PHP, the $_POST['value'] element would be an array -
Array
-
(
-
[1] => first
-
[2] => second
-
[3] => third
-
[4] => fourth
-
)
-
You could create input boxes for whichever columns you needed updated, using the name of the column as they input name, and then put the ID of the column in as the array index.
Atli 5,058
Expert 4TB @TheServant
It *is* inside his loop. Take a closer look ;-) @prabirchoudhury #1. There is no "right" way to echo variables. Only "preferred" ways. (Given that it is syntactically correct, of course. (Which it is))
Sure, the method he uses is usually considered a bit sloppy, but it is in no way "wrong". #2. This doesn't matter in the slightest, and is to a matter of personal preference. Many programmers actually prefer not to leave white-spaces in their conditional statements.
Not trying to sound argumentative here, but...
@Atli
My mistake. Thanks Atli ;)
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Randell D. |
last post by:
HELP!
I am determined to stick with this... I'm getting there... for those who
haven't read my earlier posts, I'm createing what should be a simple
function that I can call to check that...
|
by: Oleg |
last post by:
Hello there:
I've been trying to create two different sets of required fields in
one form and to use a
radiobutton as sort of a switcher between these sets.
In my HTML form there are two...
|
by: umashd |
last post by:
Hi,
I am doing a web based project for my graduation. I studied bit of java
for backend processesing and javascript for the client. Here is the
scenario.
In the FORM, I use INPUT TYPE=text...
|
by: Navillus |
last post by:
Hey gang,
I have a login form that is empty by default, but can be filled with
values from a previous form:
<input type=text maxlength="40" size="40" name="user" value="`usr`">
<input...
|
by: jedimasta |
last post by:
Good evening all,
I'm a relatively new to javascript, but I've been working with
ColdFusion and PHP for years so I'm not necessarily ignorant, just
stuck and frustrated. Using ColdFusion I'm...
|
by: Girish |
last post by:
Hi Everyone,
I am passing a form to a php script for further processing.
I am able to retrieve the last value set for that given form variable
using
$variable=$_REQUEST;
|
by: Greg Scharlemann |
last post by:
I'm trying to setup a dyamic dropdown list that displays a number of
text fields based on the selected number in the dropdown. The problem
I am running into is capturing the data already entered...
|
by: ak1dnar |
last post by:
Hi, I got this scripts from this URL
There is Error when i submit the form.
Line: 54
Error: 'document.getElementbyID(....)' is null or not an object
What is this error.
Complete Files
|
by: Jerim79 |
last post by:
I need to create a form that takes a number that the user enters, and
duplicates a question the number of times the user entered. For
instance, if the customer enters 5 on the first page, when...
|
by: uranuskid |
last post by:
Hey folks,
I was going to include a contact form on my website. Well, in the first place that seemed an easy thing to do with a form that prompts a PHP file validating the input vaiables and using...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
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,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
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...
| |