Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

$_POST problem 1

Status
Not open for further replies.

z3phir

Programmer
Dec 15, 2002
16
RO
hi ! i have a form and i submit some values using post
in the form i use somehting like this

$nrvoci=$_REQUEST['nrvoci'];$i=0;
while ( $i<= $nrvoci){?>
<tr><td width=&quot;100&quot;>Nr. <? print $i ?></td>
<td width=&quot;100&quot;><select name=&quot;fieldnr<?print $i?>&quot; size=&quot;1&quot;>
<option value=&quot;text&quot;>text</option>
<option value=&quot;numberfield&quot;>number field</option>
<option value=&quot;password&quot;>password</option>
<option value=&quot;textarea&quot;>text area</option>
<option value=&quot;filefield&quot;>file field</option>
<option value=&quot;selectbox&quot;>choices box</option>
</select></td><? $i++;}?>
now the problem is that i don't know how to get the selected values. how to use $_POST to get the values ?
i know that this isn't posible $newnr=$_POST['fieldnr<?print $i?>']; but how to get the values ?
 
First of all, I strongly recommend that you use a different PHP programming metaphor. Your example reference (&quot;$newnr=$_POST['fieldnr<?print $i?>'];&quot;) tells me that you're using the metaphone where you output HTML and switch into and out of PHP mode only to perform PHP tasks. I strongly recommend that you stay in PHP mode and use print or echo statements out output your HTML.


In general, $_POST is an array.

<?php
print $_POST['fieldnr1'];
?>
or

<?php
print $_POST['fieldnr'.$i];
?>

will probably do what you want to do.







Want the best answers? Ask the best questions: TANSTAAFL!!
 
Oh sorry I meant:

while ( $i<= $nrvoci){
print $_POST[&quot;fieldnr&quot;.$i];
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top