Jump to content

Recommended Posts

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 ?

Link to comment
https://forums.phpfreaks.com/topic/183669-split-function-no-longer-used/
Share on other sites

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.

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. 

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 ?

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
}
?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.