/    Sign up×
Community /Pin to ProfileBookmark

PHP IMPLODE METHOD

$gettenses = mysqli_query($conn, “SELECT tense_name FROM tenses”);
if ($gettenses)
{
$i = 0;
while($gottenses = mysqli_fetch_assoc($gettenses))
{
echo “<input type=’checkbox’ name=’tenses[]’ id=’tenses’ value=’tenses’> {$gottenses[‘tense_name’]}<br>”;
$i++;
}
}

how to submit these values in next table by using

$tenses= $_POST[‘tenses’];
$tensess = implode(‘,’, $tenses);

to post a comment
PHP

6 Comments(s)

Copy linkTweet thisAlerts:
@ginerjmDec 22.2019 — Not sure what you want to do here. An implode is going to convert your array into a string. You don't want to save that string in a table. The right way to do it is to save each tense value (from the array) in its own record. That is proper RDBMS structure.
Copy linkTweet thisAlerts:
@jasmine381authorDec 23.2019 — @ginerjm#1612092 ,, i want to store tense table data id in next table by single check box or multiple ,,, like 1, 2,

1 ,2 is the tenses name and insert in to next table ?
Copy linkTweet thisAlerts:
@NogDogDec 23.2019 — > @jasmine381#1612088 how to submit these values in next table by using
>
> $tenses= $_POST['tenses'];

> $tensess = implode(',', $tenses);


If we assume that you are going to go ahead and use unnormalized data like that (for better or worse), that code should work -- though I'd just simplify it it to $tenses = implode(',', $_POST['tenses']);. So, what are you asking: how to do an INSERT query, or...?
Copy linkTweet thisAlerts:
@jasmine381authorDec 23.2019 — [upl-image-preview url=https://www.webdeveloper.com/assets/files/2019-12-23/1577122141-573272-errorrrrrr.png]

I want to get tenses name id like 1,2,3 by this and insert into next table to get ids
Copy linkTweet thisAlerts:
@ginerjmDec 23.2019 — Sorry - but I see that you are already storing data improperly. I can't help you continue on with this, whatever you are asking right now.

Good luck.
Copy linkTweet thisAlerts:
@jasmine381authorDec 23.2019 — @ginerjm#1612140 i think you are not getting my points what am trying to tell you anyway thanks
×

Success!

Help @jasmine381 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.15,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...