473,394 Members | 1,759 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Post type Submit when radio button clicked

I want to effectively do a Post type submit to the very same page when the user clicks on a particular radio button. Of course, I also want it to recognize the click (i.e. checkmarking the radio button) first so the new status of that readio button gets properly Posted.

How do I do that?
Jun 19 '07 #1
3 7044
pbmods
5,821 Expert 4TB
Heay, RogerInHawaii.

What you'll want to do is set the checked property of the radio button, then submit the form. You may also need to change the action of the form.

Expand|Select|Wrap|Line Numbers
  1. <form id="thePfhorm" action="somepage.php" method="post">
  2.     <input type="radio" onclick="doClick(this);" />
  3. </form>
  4.  
Expand|Select|Wrap|Line Numbers
  1. function doClick(element) {
  2.     element.checked = true;
  3.     var pfhorm = document.getElementById('thePfhorm');
  4.     pfhorm.action = location.href;
  5.     pfhorm.submit();
  6. }
  7.  
Jun 19 '07 #2
pbmods,

Is there a way to do that with just PHP? Can the OnClick call a PHP function and then within the PHP fnction cause a submit to occur?

Or can the Onclick itself somehow specify a submit?

- Roger
Jun 19 '07 #3
pbmods
5,821 Expert 4TB
Heya, Roger.

Is there a way to do that with just PHP? Can the OnClick call a PHP function and then within the PHP fnction cause a submit to occur?
Unfortunately, no. PHP and JavaScript cannot interact. Think about it like this: PHP is server-side, whereas JavaScript is client-side, and the only way to make a server request from JavaScript is (currently) to use AJAX.
Jun 20 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: panayiotis periorellis | last post by:
Hello All, Im trying to pass some parameters to a CGI script from Java. I know how to pass simple parameters but im having trouble passing the radio button. Could someone please have a look at...
1
by: Jawahar Rajan | last post by:
All, I am using a few Input type of "Image" instead of a classic submit button in a form to achieve various tasks for example image1 - add user image2 - modify user image3 - delete user...
3
by: Tom Asken | last post by:
Short version: IE 6.0 wrongly posts <button ..> value. Internet Explorer should only post the value of the clicked submit button - but IE 6 posts the value of several submit buttons if they have...
5
by: Jack | last post by:
Hi I am trying to test a form as to its correct action. I am facing two problems. 1) When I click the submit button, the registrationconfirmation.asp is not activated. The...
5
by: Thejo | last post by:
Hi all, I started programming in PHP recently and have a query about empty $_POST arrays. I can see two scenarios when this could happen. 1. When some tries to directly load the page to which...
7
by: Matt | last post by:
Hi all, Not very sure about this. I have one button (not a submit button) will "post" partial page(form) info to another url(the user will also redirect to this url :-). I dont' want to change...
2
by: monomaniac21 | last post by:
Hi I know this isnt really a php question but can anyone tell me how you parse post variables to a popup window, here's my code so far, im trying to pass the value entered into a radio button: ...
3
by: Yourself | last post by:
Hi, I'm trying to post data to PayPal for a shopping cart, basically I want to replicate a form like the following, but create the variables dynamically from code behind: <form...
2
by: fliss | last post by:
Hello I have four submit buttons on my page - each carrying a value which refreshes the page selects from my db and displays the results in the drop down. The prob is i would like another...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.