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 5838899
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T11:31:02+00:00 2026-05-22T11:31:02+00:00

I have a post php form and a set of inputs: Your Name Your

  • 0

I have a post php form and a set of inputs:

  1. Your Name
  2. Your Last Name
  3. My Name

Every input looks the same, only the names change:

<input type="text" name="your_name" value="<?php echo get_option('your_name'); ?>" />

How to set default values when value= is not available?

[edit]

Ok, so, normally I’d do something like:

<input type="text" name="your_name" value="Mike" />

But in this case I have a PHP script that grabs inputs data and displays it using value="<?php echo get_option('your_name'); ?>" . So I have no idea how to force my form to display “Mike” in my input.

  • 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-05-22T11:31:02+00:00Added an answer on May 22, 2026 at 11:31 am

    You need to check the return of get_option first, and substitute something if a default is not available

    <?php
        $default = get_option('your_name');
        if( $default == "")
        {
            $default = <whatever your default value is>;
        }
    ?>
    <input type="text" name="your_name" value="<?php echo $default; ?>" />
    

    Change get_option to return an empty string (or something else) if the default is not available.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an HTML form: <form action='process.php' method='post'> <input type='checkbox' name='check_box_1' /> Check me!<br>
I have a form set up like this in HTML: <input type=text name=data[type1][0] value=
I have a post html form, and the action is index.php, which is the
I have a form on which I POST the data with PHP. When the
How do I set the form restrictions in php to only allow jpgs and
I have code as follows: $(#item_select).change(function() { var params = $(#item_select option:selected).val(); $.post('/account/ar_form.php', {idata:
Sounds like a weird question, but say I have something like this: $.post( /myajax.php,
I have a PHP script on a server <?php // retrieve POST vars $comment
I have the problem, that PHP replaces all spaces with underscores in POST and
I have a winForms NET3.5SP1 app, and want to POST data to a PHP

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.