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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

adding two variables to create one variable

Status
Not open for further replies.

krappleby025

Programmer
Sep 6, 2001
347
NL
simple one.. I have two variables

one variable is

$del
and the other is
$num

i need to take the $del and the $num and create one variable..

ie $num = 1
so i want to get $del1

in other words i want ot create

$del$num

any ideas
 
ok its simple

i have used the follwoing code *dont know how to use arrays yet, new to php

if ($num <> $numitems or $numitems == "0")
{
if ($del == "yes")
{
$query = "delete from orders where ipaddy = '$ipaddress' and plant = '$plant'";
mysql_query($Getorder) or die ("could not Delete order");
$num++;
}
}
else
{
header("Location: order.php?area=$Shipping");
}


this will delete the record if

del1 = yes
del2 = yes

i send a form with the variables

del1, plant1, del2, plant2, etc

and need to create a script, so that if del1 = yes then delete the plant from the databse

thanks
 
Try ${$del$num} Its a nice trick that is hard to find. You can be pretty creative with it..

${$del."-".$num} for example would be like saying $del-1 or $del-2

You can use any of the string operators inside the brackets.

-Dustin
Rom 8:28
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top