I need to open a file containing page names and create a form to set the order in which they are to be shown. The first PHP code shown produces the form using the variables in the pageorder.php file (name/page) then using the form overwrite the file with updates using implode... pageorder.php file: home/index|about/about|contact/contact PHP: CODE: if(!$_POST['sumbit']) { $filename = "../includes/pageorder.php"; $handle = fopen($filename, "r"); $Content = fread($handle, filesize($filename)); fclose($handle); echo '<form method="post" action="">'; $pagearray = explode("|", $Content); foreach( $pagearray as $pagedetails){ list($name, $page) = explode("/", $pagedetails); echo '<p><input readonly style="background:#fff;border:0;" type="text" name="page" value="'.$page.'"/>' . "\n"; echo ' > <input type="text" name="name" value="'.$name.'" /></p>' . "\n"; echo '<input type="text" name="namepage" value=""/>' . "\n"; } echo '<p><textarea name="pageorder" cols="50" rows="10">'. $Content .'</textarea></p>'; echo '<p><input class="button" type="submit" name="sumbit" value="submit"/> '; echo '<a class="button" href="index.php">cancel</a></p>'; echo '</form>'; } else { $Content = $_POST['pageorder']; $reffilename2 = "../includes/pageorder.php"; $ourFileName2 = $reffilename2; $ourFileHandle2 = fopen($ourFileName2, 'w') or die("can't create PHP file"); $ourFileData2 = $Content; fwrite($ourFileHandle2, $ourFileData2); fclose($ourFileHandle2); } PHP: i have tried using these: $pieces = array($name,$page); $glue_pipe = implode("|", $pieces); $glue_slash = implode("/", $pieces); for($i = 0; $i < count($pieces); $i++){ echo "Piece #$i = $pieces[$i] <br />"; } echo "Glued with Spaces = $glue_pipe <br />"; echo "Glued with Dashes = $glue_slash"; $arr = array($name,$page); $separated = implode("/", $arr); echo $separated; $separated1 = implode("|", array($separated)); echo $separated1; PHP: but neither work... this is very urgent!!! thanks!!!
I am sorry but i can't understand your question. Can you clarify what do you want? Maybe with some image for guide or something like that
If you want to split multiple parts into an array (I assume it is what you want?) then you'd probably want to use the split() function which is able of regex splitting into arrays.