Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9124777
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:38:35+00:00 2026-06-17T06:38:35+00:00

Information.php <?php if (empty($_POST)===false){ $required_fields = array(‘first_name’,’last_name’,’gender’,’age’,’location’,’about_me’); foreach($_POST as $key =>$value){ if(empty($value) && in_array($key,

  • 0

Information.php

<?php

if (empty($_POST)===false){
    $required_fields = array('first_name','last_name','gender','age','location','about_me');
    foreach($_POST as $key =>$value){
        if(empty($value) && in_array($key, $required_fields) === true){
            $errors = 'fillin';
            break 1;
        }
    }
}
if (empty($_POST)=== false && empty($errors) === true){

    $update_data = array(
        'first_name' => $_POST['first_name'],
        'last_name' => $_POST['last_name'],
        'gender' => $_POST['gender'],
        'age' => $_POST['age'],
        'location' => $_POST['location'],
        'about_me' => $_POST['about_me']
    );
    update_user($update_data);
    echo 'updated';
}else if (empty($errors) === false){
    echo $errors;
}
?>
        <form action = "" method = "POST">
        First Name: <input type = "text" name = "first_name" maxlength = "40" placeholder = "First Name" value = "<?php echo $user_data['first_name']; ?>"><br>
        Last Name: <input type = "text" name = "last_name" maxlength = "40" placeholder = "Last Name" value = "<?php echo $user_data['last_name']; ?>"><br>
        Gender: <select type = "text" name = "gender" value = "<?php echo $user_data['gender']; ?>"><option>Select</option><option name = "male" value = "Male">Male</option><option name = "female" value = "Female">Female</option><option name = "othergen" value = "Other">Other</option></select><br>
        Age: <input type = "text" name = "age" maxlength = "3" placeholder = "What's your age?" value = "<?php echo $user_data['age']; ?>"><br>
       Location: <input type = "text" name = "location" maxlength = "100" placeholder = "Your location?" value = "<?php echo $user_data['location']; ?>"><br>
        About Me: <textarea type = "text" name = "about_me" maxlength = "500" placeholder = "Say something about yourself!" value = "<?php echo $user_data['about_me']; ?>"></textarea><br>

        <input type = "submit" value = "submit">
        </form>

Main problem is that it is not showing the value of the textarea and the select box which I manually updated through PHPmyadmin, but it shows the ones in the textboxs just fine.

UPDATE: The fields are now updating successfully! Even the text area and selectboxs are updated in the table. However, the value is not showing in the textarea or in the select box. So the problem still persists!

variable user_data:

$user_data = user_data($session_user_id,'user_id','username','password','first_name','last_name','email','gender','age','location','about_me');
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T06:38:36+00:00Added an answer on June 17, 2026 at 6:38 am

    As defined by the W3C, textarea does not have a value attribute. Instead, the value is wrapped by the <textarea></textarea> tags

    <TEXTAREA name="thetext" rows="20" cols="80">
        First line of initial text.
        Second line of initial text.
    </TEXTAREA>
    

    This is also valid for the document type HTML5

    A <select>..</select> will always submit the first <option> by default. If you want to preselect another option, you have to add the attribute selected="selected" to this option.

    http://www.w3.org/TR/html401/interact/forms.html#h-17.6.1

    Select does not have a type attribute.

    Example: how to add the selected attribute in a PHP template

    <select name="fieldname">
        <option value="on select,submitted value" <?php echo $myValue == 'on select,submitted value' ? ' selected="selected"' : ''; ?>>displayed value</option>
        <option value="on select,submitted value 2" <?php echo $myValue == 'on select,submitted value 2' ? ' selected="selected"' : ''; ?>>displayed value</option>
    </select>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

<?php $name = $_POST[name]; $email = $_POST[email]; $gender = $_POST[gen]; $age = $_POST[age]; $comments
if(isset($_POST['submit2'])) { if($_POST['linklabel'] == '') { header('Location: index.php?VIEW=BLAH&message=failure'); } else { Here is my
I have a login setup on a site that stores login information in PHP's
This Ajax is not retrieving any information from its' PHP file as it should,
In PHP I am able to retrieve information from a db like so: <?php
Information: I have a site that has a design on index.php, and then you
My test.php file contains the following information that is sends list of information. while($row
Im using PHP to output the category information from an RSS feed: foreach(item_category()) as
I am using php-sdk for showing facebook information of the user. I have successfully
I am working for a PHP project that retrieves file meta information . All

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.