Jump to content

Search the Community

Showing results for tags 're-populating'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. Hi people, I'm new to PHP, and I'm having some real difficulties with trying to re-populate a radio button selection on a form. Basically, I'm working on a WordPress plugin which uses custom fields to create a Bet custom post type. I need to have my form submit the user input, then re-populate it so that if the user wants to edit and update the Bet data, they don't have to fill in the whole form details again, they can just edit what they need to, and update (re-submit) the form. I've managed to get all of the form elements re-populating, apart from a radio button. I've been trawling round the internet for most of yesterday evening and this morning, trying different things, but nothing I've found works for me. I'd really appreciate some help if anyone knows how to do this. Here's my code so far (non working) <?php $win_status = 'checked = "unchecked"'; $ew_status = 'checked = "unchecked"'; if (isset($bet_details_bet_type)) { $selected_radio = $bet_details_bet_type; if ($selected_radio == 'WIN') { $win_satus = 'checked = "checked"'; } elseif ($selected_radio == 'EW') { $ew_status = 'checked = "checked"'; } } echo '<label for="bet_details_bet_type">Bet Type: </label>'; echo '<input type="radio" name="bet_details_bet_type" id="bet_details_bet_type" value="WIN" '. esc_attr( $win_status) .' /> Win '; echo '<input type="radio" name="bet_details_bet_type" id="bet_details_bet_type" value="EW" '. esc_attr( $ew_status) .' /> Each Way </br>'; $bet_details_bet_type is the VARIABLE that gets sent to / pulled from $_POST I have another function which is handling that, which has the following in it. $bet_details_bet_type = $_POST['bet_details_bet_type']; update_post_meta( $post_id, 'bet_details_bet_type', $bet_details_bet_type ); I know that the sending and retrieving is working okay, as the Value is stored and retrieved when I update (submit) the bet, but I just can't seem to get the radio button to be re-checked to the value that was submitted. Again, if any can help with this I would be very grateful. Thanks, Dweezer
×
×
  • 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.