/    Sign up×
Community /Pin to ProfileBookmark

10 check boxes,each return different value

Dear friends,
i’m just started learning php,get some school project.can any one help me to solve this problem,if i got 10 check box,each time i click on it then it activate text box.after klick submit it will return 2 value ,first the checkboxes value and the textbox value.

cbox1 – tbox1(hide before cbox1 clicked)
cbox2 – tbox2(hide before cbox2 clicked)
cbox3 – tbox3(hide before cbox3 clicked)
:
:
untill
cbox10 – tbox4(hide before cbox10 clicked)
(OK) button
when ok button click it will get the value which checkbox get click and the value of text box from the particular checkbox.
If any help out there i will be very appreciated..
thanks?

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@JunkMaleDec 01.2011 — You have not posted any code which makes it hard for people to help you.

Simply posting your requirements and expecting answers might be a long wait because of the obvious problem that you have not given anyone something to work with. What often happens is several posts of "Answers" to your problem will appear over time but none (in experience) will fit your needs or will be programming above your current experience level.

Therefore it is wise to post code wrapped in tags, this not only helps people help you but also reveals what you know about javascript and people are not shooting answers in the dark hoping to hit the spot.

Most of what you ask is available through searching the forums, check boxes, input boxes, showing / hiding stuff, etc...
Copy linkTweet thisAlerts:
@tora_pinauthorDec 02.2011 — this is the code:

<script type="text/javascript">

function enableText(checkBool, textID)

{

textFldObj = document.getElementById(textID);

//Disable the text field

textFldObj.disabled = !checkBool;

//Clear value in the text field

if (!checkBool) { textFldObj.value = ''; }

}

</script>

</head>

<body>

<Center>

<?

//contacts - ID, cname, cnumber, userid

$rs=mysql_query("SELECT * FROM Student WHERE zomname='".$_SESSION['username']."';",$conn) or die("Couldn't fetch records from stud");

$count=mysql_num_rows($rs);

$saldos=' '.$_
SESSION['saldo'];

<TABLE align="center" border="1" cellspacing="0" cellpadding="3">

<TR bgcolor="#FFC600"><TH><b>NOMOR<b></TH><TH>PILIH</TH><TH>JUMLAH</TH></TR>

<TR><TD><center>0</center></TD><TD><center><input id="myCheckBox" type="checkbox" onclick="enableText(this.checked, 'myTextArea');" /></center></TD><TD>RP : <input id="myTextArea" type="text" disabled="disabled" maxlength="7" size = "9" /></TD></TR>

<TR><TD><center>1</center></TD><TD><center><input id="myCheckBox" type="checkbox" onclick="enableText(this.checked, 'myTextArea');" /></center></TD><TD>RP : <input id="myTextArea" type="text" disabled="disabled" maxlength="7" size = "9" /></TD></TR>

<TR><TD><center>2</center></TD><TD><center><input id="myCheckBox" type="checkbox" onclick="enableText(this.checked, 'myTextArea');" /></center></TD><TD>RP : <input id="myTextArea" type="text" disabled="disabled" maxlength="7" size = "9" /></TD></TR>

</TABLE>

</center>

</body>

</html>

i want to make 10 check boxes,when people choose or click the checkboxes then the text box beside it will enable.so the user can put their price there.after all done they click "ok".then i will get value of which number they choose and what the price they put on each number.Thanks.

You have not posted any code which makes it hard for people to help you.

Simply posting your requirements and expecting answers might be a long wait because of the obvious problem that you have not given anyone something to work with. What often happens is several posts of "Answers" to your problem will appear over time but none (in experience) will fit your needs or will be programming above your current experience level.

Therefore it is wise to post code wrapped in tags, this not only helps people help you but also reveals what you know about javascript and people are not shooting answers in the dark hoping to hit the spot.

Most of what you ask is available through searching the forums, check boxes, input boxes, showing / hiding stuff, etc...[/QUOTE]
×

Success!

Help @tora_pin spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...