Hi all,
I want to concatenate 2 things that is first name and last name.but in foreach statement i am getting error.Hope fully foreach statement doesnot take 2 posts at a time.
What i want to do is:
First name 1=A
Last name 1=B
First name 2=C
Last name 2=D
So i want the out put will be AB and CD. But when i am doing it in other way then i am getting AC and BD which is incorrect.
//if the form is being submitted
if(isset($_POST[“submit1”]))
{
unset($fname);
foreach($_POST[‘fname’],$_POST[‘fname’], as $key=> $value)
{
$fname .= $value;
$lname .= $value;
$name .= $fname.$lname.”,”;
}
}//Post finish
<form action=”detail.php” method=”post” name=”frm” style=”margin:0px”>
for($i=1;$i<=2;$i++)
{
?>
<tr>
<td width=”28%” height=”30″>First Name
<?=$i;?>
<font color=#ff0000>*</font>:</td>
<td width=”72%” height=”30″>
<input maxlength=60 name=”fname[]” size=25>
</td>
</tr>
<tr>
<td width=”28%” height=”30″>Last Name
<?=$i;?>
<font color=#ff0000>*</font>:</td>
<td width=”72%” height=”30″>
<input maxlength=60 name=”lname[]” size=25>
</td>
</tr>
<? } ?>
<input name=”submit1″ type=”submit” value=”Proceed” class=”button”>
Please suggest me what should i do to get the desired output.i think i am doing mistakes at some other places.
Thanks for your help in advance.
Raj