I have plus icon next to an input field in my form to so I can add more input fields. Name of the fields are automatically generated to in this form -> "one_f1", "one_f2" ...
When I create the mail to send it out, I need to create a while loop for this so I can put all the values that are sent from the form. I am stuck while trying to add while loop in a variable called body because it has to be in the body of a mail.
how can I fix this?
Here is the code;
$body ='
<ul>
while(isset($_POST["one_f".$i]))){
echo "<li style=\"list-style: circle;\">".$_POST["one_f".$i]".</li>";
}
</ul>
';
What's wrong with appending?
$body = "<ul style=\"list-type-type:circle\">";
$i = 1; // whatever number the first field is
while(isset($_POST['one_f'.$i])) {
$body .= "<li>".$_POST['one_f'.$i]."</li>";
$i++; // you forgot this in your code!
}
$body .= "</ul>";
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.