Jump to content

how to store value from a array into one variable?


friedice

Recommended Posts

hello, um i got a form that stored an array of variables upon users clicks.

it submits to another page fine as an array and i can print them using

if(!empty($_POST['langSpoken'])) {

    echo "\n<p><strong>You selected the following LangSpoken:</strong></p>\n<ul>";

    foreach($langSpoken as $lang) {

      // exclude any items with chars we don't want, just in case someone is playing
      if(!preg_match('/^[-A-Z0-9\., ]+$/iD', $lang)) continue;

      // print the lang
      echo "\n\t<li>" . htmlspecialchars($lang) . "</li>";
    }
    echo "\n</ul>";

  } 
  else {
    echo "\n<p>No items selected</p>";
  }

 

it prints a list a of array like

  • english
  • spanish

 

but i need to store each one in one variable so i can store in a database

is there a way?

thx

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.