Jump to content

Recommended Posts

Hello, before i start please sorry for my english, I'm not from english speaking country so my english is not that good.

my Question:
is there any possibility to put 2 or more values in one input type ? I making something like ordering-system. you can imagine it like : You want buy monitor and there is 3 radio inputs for 19" screen, 22" screen and 24" and next to them are pices:

○ 19" screen - 1100 dollars

○ 22" screen - 1200 dollars

○ 24" screen - 1300 dollars

And when i click 'submit' i want to show on another page form.php see what he chose so for example its shows 24" screen - 1200 dollars

 

And there is problem. In <input> is just one value (only for price or name of product - screen in my case)



I have this code but it shows only price in form.php :

 

<input type="radio" name="xxx" value="1100 dollars" onclick='check_value(this, 1)'">
(that onclick='check_value(this, 1)' is javascript counting system its irelevant)

and in form.php


 

<? echo $_POST["xxx"];  ?>

Why?
This what i posted works but its only show in form.php '1100 $ dollars' but i want to for example :
 mac book - 1100 dollars.

my idea is something like this :
<input type="radio" name="xxx" value="1100 dollars" value2="macbook" onclick='check_value(this, 1)'">
and when i confirm it i want in form.php
macbook 1100 dollars

I tried it with this code:
 

 

    <input type="radio" name="xxxcena" value="PRICE" onclick='check_value(this, 1)' />
    <
input type="text" name="xxxtyp"  value="PRODUCT" hidden />


and in post.php



 

        <tr bgcolor="#f0f8ff"> <td>
        <? echo 
$_POST["xxxcena"];  ?>
        </td> <td>
        <? echo $_POST["xxxtyp"];  ?>
        </td> </tr>


But it dont work (only shows one product no matters what i chose from my options in form).

Please if its not possible can you tell me how to do it?

Once again im very sorry for my bad english and i hope someone of you understand what i need. Thanks for any help. -exer

Link to comment
https://forums.phpfreaks.com/topic/276236-more-values-in-one-input-in-form/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.