EchoFool Posted December 2, 2009 Share Posted December 2, 2009 I just seen here: http://php.net/manual/en/function.split.php This comment; This function has been DEPRECATED as of PHP 5.3.0 and REMOVED as of PHP 6.0.0. Relying on this feature is highly discouraged. I was about to use this to separate two arrays which are joined in a input "name" like this : <input type="input" name ="RecordID[<?php echo $row['RecordID'];?>],Value[]" value""> I was going to use split on the "," value so i had both values in an array to process but now it says not to use the function - so what should i do to get the values out ? Quote Link to comment https://forums.phpfreaks.com/topic/183669-split-function-no-longer-used/ Share on other sites More sharing options...
.josh Posted December 2, 2009 Share Posted December 2, 2009 if you are only wanting to split at a comma, use explode. If you want to split by regular expression, use preg_split Quote Link to comment https://forums.phpfreaks.com/topic/183669-split-function-no-longer-used/#findComment-969422 Share on other sites More sharing options...
EchoFool Posted December 2, 2009 Author Share Posted December 2, 2009 Okay - final question - if I'm passing an array in my input box, and i have this instead: <input type="input" name ="Value[]" value""> But i need it to pass an array where it has the value="" that the user inputted + a record id to with it.. how can that be done in the value box without record ID being displayed? So its like [key] : "RecordID" "Input Value" Example: [0] = "1" "25" Record id is a $RecordID from the while loop i should add. Quote Link to comment https://forums.phpfreaks.com/topic/183669-split-function-no-longer-used/#findComment-969432 Share on other sites More sharing options...
.josh Posted December 2, 2009 Share Posted December 2, 2009 assuming the recordID is unique, explicitly name the Value[] array element with it, like name="Value[$recordID]" then when user posts it, the array keys are your record IDs and the values are the values the user submitted, associated with it. Quote Link to comment https://forums.phpfreaks.com/topic/183669-split-function-no-longer-used/#findComment-969433 Share on other sites More sharing options...
EchoFool Posted December 2, 2009 Author Share Posted December 2, 2009 Yeh i tried that but then i had one issue again. Cos i tried this; <?php $Var = $_POST['Value']; foreach($Var As $Values){ Echo $Values[0] // recordID Echo $Values[1] // input value ] ?> Which didn't work i can get input value but i cannot grab record id from the array ? Quote Link to comment https://forums.phpfreaks.com/topic/183669-split-function-no-longer-used/#findComment-969435 Share on other sites More sharing options...
.josh Posted December 2, 2009 Share Posted December 2, 2009 no that's not quite right. Say you have this: //pseudocode while (...) { <input type = 'text' name='Value[$recordID]' /> } Then your code would look more like this (for example): <?php $values = $_POST['Value']; foreach($values As $key => $val){ echo $key; // recordID echo $val; // input value } ?> Quote Link to comment https://forums.phpfreaks.com/topic/183669-split-function-no-longer-used/#findComment-969437 Share on other sites More sharing options...
EchoFool Posted December 2, 2009 Author Share Posted December 2, 2009 Argh i see - thank you Quote Link to comment https://forums.phpfreaks.com/topic/183669-split-function-no-longer-used/#findComment-969454 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.