Hi guys,
this is the code I want to change:
[php]
$li = ‘
for ($i=1; $i<=10; $i++) {
if (isset($_GET[‘add’]) && ($_GET[‘add’] == ‘’.$i.‘ingredients’)) {
$repeat = str_repeat($li, $i);
echo $repeat;
}
echo " Add ingredient ";
}
[/php]
So, I am trying to create a form where the user adds a recipe. I have input for every ingredient. Under the inputs should be a link that says: “Add ingredient” - and a new input should appear. The problem in my script is that the link is shown $i times, because, off course, is in a loop.
How could I echo the link just one time, with the last $i value… I tried echo-ing the link out of the loop, but it doesn’t work like that.
I’m new to php and programming generally… ???
Thank you in advance. Hope I was clear with my problem.