I’m trying to customize an existing opensource script and ran into a snag. In the processing file, I’m using the following line to retrieve the user’s input from a form they submit.
$listingKeywords = $_POST["listingKeywords"];
The user is asked in the form to enter the keywords with a comma in between each one (example: Keyword One, Keyword Two). Within the processing file, I have the following…
$keyword_list = array(
'1'=>"HTML5",
'2'=>"CSS3",
'3'=>"PHP",
);
This is being used later on like so:
foreach ($keyword_list as $key=>$value)
Basically I’m looking for a way to split $listingKeywords by comma and then set the $key via $i++. I know it’s simple and I’m just asking for someone to point me in the right direction.
Thanks!
$arr = explode("," $content);is this what you want?
Just remember to use
trimbefore putting them into a database, people well tend to do usevalue1, value2, value3