0

Hey guys,

I've got a problem with a form that I've made. Basically the form loads a number of textboxes based on how many columns are in a table. I don't have any problems doingthat, but on the next page I'm trying to put the textbox values into a string variable using $str &= $_POST['txt'.$i].

It goes through a loop which should gather the textbox value and add it to a string, but when I display the string after it has done this, it displays nothing.

Any help is much appreciated :)

2
Contributors
3
Replies
4
Views
5 Years
Discussion Span
Last Post by Wolxhound90
1

$str &= $_POST['txt'.$i].

$str .= $_POST['txt'.$i];

not sure what &= does

You could also just loop through the $_POST array

$str = '';
foreach($_POST as $k=>$v){
    if(substr($k,0,3) == 'txt'){
        $str .= $v;
    }
}
echo $str;
0

ahhh, I thought &= was used to add extra information onto the end of a string variable. I shall try this, thank you :)

0

Yeah, all I needed to do was change my &= to .= and it works fine now. Thank you so much :)

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.