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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:56:05+00:00 2026-05-27T16:56:05+00:00

1) If POST value is set save the content from the POST value in

  • 0

1) If POST value is set save the content from the POST value in a variable.

if(isset($_POST["spart"])) {
    $spart = $_POST["spart"];
 }else{
        $spart = '';
 }

2) If variable contains a certain value, make the input field checked.

<input id="radio_dump_select_spart1x2" class="copy" type="radio" name="spart" value="1x2" <?php if ($spart=="1x2") echo 'checked="checked"';?>>

The problem now is that some jQuery functions should be called if a checkbox is checked. I already have them in the header but they only work if the user clicks on it. It doesn’t work if it is set in PHP like described above.

3) OK, let’s try to call some actions if input is checked:

<input id="radio_dump" type="radio" name="spart" value="1x2" <?php if ($spart=="1x2") echo 'checked="checked"';?> onclick="if($(this).is(':checked')) { alert('test'); hide_them_all(); $('#select_tb').show(); }; return true"> Text</div>

I thought I could use the onclick attribute, but it seems that it won’t work.

  • 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-27T16:56:06+00:00Added an answer on May 27, 2026 at 4:56 pm

    This is how it can be done:

    <?php if ($spart=="1x2") { ?>
     <script type='text/javascript'>
      $( function() {
       alert('test'); 
       hide_them_all(); 
       $('#select_tb').show();
      } );
     </script>
    <?php } ?>
    

    You can insert this almost anywhere with no problems.

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

Sidebar

Related Questions

<body> <div> <?= $_POST['msg'] ?> </div> <form id=frm method=post> <input type=hidden name='msg' value='{field0: Im
this is my entire PHP code: <?php if(empty($_POST['selid'])) {echo no value selected; } else
I've written this code to try and send a url as a post value
echo $_POST[name]; //returns the value a user typed into the name field I would
I need to enable/disable post comments regarding the value of a new field in
I'd like to compute a value and carry that computation in the form post,
Lets say for example: $(.button).click(function() { $.post(commandrunner.php, { param1: 'value', param2: 'value2', param3: 'value3'
This code fails to actually save any changes: // // POST: /SomeType/Edit/5 [AcceptVerbs(HttpVerbs.Post)] public
im bit confused how to save checkbox value dynamically in 1 table! database: id
I am trying to get my checkbox value to save on my dynamic created

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.