Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

PHP form problems. I'm modifying an existing script.

Need help to change drop down options to radio buttons.

11:21 am on Sep 18, 2005 (gmt 0)

New User

10+ Year Member

joined:July 25, 2005
votes: 0

Ok so I have a script that is for my small webhosting setup with cpanel and WHM.

The script has a drop down menu with options. I have like 20 options instead of the original 3 that the script was designed with so I'd like to display them in a table with radio buttons instead of the drop down menu.

The current script is set up like this:

$package_dropdown .= "<option value=\"$key\">" . $value['item_name'] . "</option>\n";

I changed it to look like this:

$package_dropdown .= "<input type=\"radio\" name=\"" . $value['item_name'] . "\" value=\"$key\">" . $value['item_name'] . "<br><br>\n";

and also to look like this:

$package_dropdown .= "<input type=\"radio\" name=\"$key\" value=\"" . $value['item_name'] . "\">" . $value['item_name'] . "<br><br>\n";

Neither worked for me.

This code is located on a self submitting form on a page called Order.php.

After submitting the dropdown menu and some text boxes it confirms all the form input then sends to paypal.

What I'm I doing wrong in the code above? If it's correct what could it be?

I have a feeling it's something to do with how the radio buttons are being submitted. I have very limited experience with radio buttons.

Thanks in advance.


12:51 pm on Sept 18, 2005 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Sept 7, 2003
votes: 0


A couple of things.

Just changing $package_dropdown .= "<option value... to $package_dropdown .= "<input type=\"radio\... isn't going to work.. but you know that already. You're trying to change this:

to this:
<input type>

Then, as you redesign the form, each radio button will require a unique name. That's pretty easy to code.

Then, the part of the script that processes the form will need to be changed to process the radio buttons.

As much as I don't like saying it, a look at your entire script would be in order. Better check first with the mods before doing a code dump, though.

Until I got a little better at coding php, I would create my forms just as they would appear in a plain html document. Then I added the php code where it was needed.


Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members