News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

posting

Started by Thunderace, May 31, 2005, 03:49:21 PM

Previous topic - Next topic

Thunderace

#20
Quote from: [Unknown] on June 04, 2005, 04:24:20 PM
You can't do that.  But, if you name them all "something[]" then you can do:

$myvar = implode('', $_POST['something']);

-[Unknown]

I read this to mean ..

name the variables like  .. something1[] .. something2[] etc etc

then use

$myvar = implode('', $_POST['something']); on each one.

Also i need to know why i'm getting an error on i ==3 as follows: -

$i = 0;
while ($i < 11) {
   if ($i == 1) fwrite($fp, $box1 . '</div>');
   elseif ($i == 2) fwrite($fp, '<div align="center">' . $box1text . '</div>');
   else ($i == 3) fwrite($fp, '<div class="main-menubox" align="center" style="width: 170px;">' . $box2 . '</div>');
   else ($i == 4) fwrite($fp, '<div align="center"><br />' . $box2text . '</div>');
   else ($i == 5) fwrite($fp, '<div class="main-menubox" align="center" style="width: 170px;">' . $box3 , '</div>');
   else ($i == 6) fwrite($fp, '<div align="center"><br />' . $box3text . '</div>');
   else ($i == 7) fwrite($fp, '<div class="main-menubox" align="center" style="width: 170px;">' . $box4 . '</div>');
   else ($i == 8) fwrite($fp, '<div align="center"><br />' . $box4text . '</div>');
   else ($i == 9) fwrite($fp, '<div class="main-menubox" align="center" style="width: 170px;">' . $box5 . '</div>');
   else ($i == 10) fwrite($fp, '<div align="center">' . $box5text . '</div>');
   $i++;
}

   fclose($fp);


error =

Parse error: parse error, unexpected T_STRING in /root/mysite/www/files/myscript.php on line 30

[Unknown]

No.... like this:

<textarea name="something[]">...</textarea>
<textarea name="something[]">...</textarea>
<textarea name="something[]">...</textarea>
<textarea name="something[]">...</textarea>

All with the *exact same* name.

For the code... you need some array mojo.

-[Unknown]

Thunderace

#22
Thanks

I've got this writing now .. the only problem is it writes all on one line.

I've searched the web and tried all variations of \n, but the \n is written to the file as a string.

***SOLVED*** this worked ..

if (fwrite($fp, "\n" . $divmm . $box5 . $div) === FALSE) {
       echo "Cannot write to file ($filename)";
       exit;
  }

Advertisement: