Hello,
I have what i think is a basic problem, i am stuck, and i thingk this must have been messy for some of the PHP guru's out there.
My problem is evaluating the value of my variable, which is posted by a form. Like for example i am posting Links and descriptions from some 20 fields in the form, and i dont want to write 50 insert statements.
Can anyone tell me how to achieve this??
Hope i am clear!!
Here's some Code for you all to see What excatly i am doing.
<<<Code>>>>
/***************************************************************************
Here the code for insert will come
*****************************************************************************/
echo "<br> Link 1 :".$txtLink1;
echo "<br> Desc 1 :".$txtUrl1;
echo "<br> Link 2 :".$txtLink2;
echo "<br> Desc 2 :".$txtUrl2;
echo "<br> Link 3 :".$txtLink3;
echo "<br> Desc 3 :".$txtUrl3;
echo "<br> Link 4 :".$txtLink4;
echo "<br> Desc 4 :".$txtUrl4;
echo "<br> Link 5 :".$txtLink5;
echo "<br> Desc 5 :".$txtUrl5;
$i=1;
if (($txtUrl2 <> "") && ($txtLink2 <> "")){
$i++;
}
if (($txtUrl3 <> "") && ($txtLink3 <> "")){
$i++;
}
if (($txtUrl4 <> "") && ($txtLink4 <> "")){
$i++;
}
if (($txtUrl5 <> "") && ($txtLink5 <> "")){
$i++;
}
echo "<br> i = ".$i;
for ($count=1; $count<=$i; $count++){
$tempLink "\$txtLink".$count;
echo "<br>TempLink : ".$tempLink;
$tempUrl = "\$txtUrl".$count;
echo "<br>TempUrl : ".$tempUrl;
$sql = "INSERT into linkstable ( LINK, description) VALUES ('".$tempUrl."','".$tempLink."')";
echo "<br> SQL : ".$sql;
}
<<< End of Code >>>
Here i want to have values of $txtLink1..$txtLink 5 in the for loop as "evaluation" in $tempLink and same for $temp Url...
Help Please
Regards
Rahul