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 :)

$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;

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

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.