Jump to content

Storing input into array?

Recommended Posts


I'm a total novice to HTML and am currently working on a really basic page: The user inputs a name into a form, and then based on their input, the page displays a series of images. Each character of the name corresponds to a different image output.

My initial idea for this was to store the value of each character of the name into an array, and then sequentially output the corresponding images.

However, I can't seem to find a way to store the input into an array, let alone one character at a time.

Any help would be much appreciated!

Link to post
Share on other sites
  • 1 month later...
if(isset($_POST) and $_SERVER['REQUEST_METHOD'] == "POST"){
        // Loop $_FILES to exeicute all files
        foreach ($_FILES['image1']['name'] as $f => $name) {     

            if ($_FILES['image1']['error'][$f] == 0) {             
                if ($_FILES['image1']['size'][$f] > $max_file_size) {
                    $message[] = "$name is too large!.";
                    continue; // Skip large files
                elseif( ! in_array(pathinfo($name, PATHINFO_EXTENSION), $valid_formats) ){
                    $message[] = "$name is not a valid format";
                    continue; // Skip invalid file formats
                else{ // No error found! Move uploaded files 
                    if(move_uploaded_file($_FILES["image1"]["tmp_name"][$f], $path.$name))
                    //Write insert query here. image name $_FILES["image1"]["name"][$f]


Link to post
Share on other sites

Join the conversation

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

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

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