473,321 Members | 1,669 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,321 software developers and data experts.

How to get a text input value into a php script

Dear all,

here is the code:
-----------------------------
<tr>
Â* Â* Â* Â* <td>ohne Anmeldung: </td>
Â* Â* Â* Â* <td><input name="vanm" id="vanm" type="checkbox"
onclick="DisableTeilnehmerzahl()"></td>
</tr>
<tr>
Â* Â* Â* Â* <td>Max. Teilnehmerzahl: </td>

Â* Â* Â* Â* <td><input name="vteilz" id="vteilz" type="text" size="1"
maxlength="3"
></td>
</tr>
-----------------------------
function DisableTeilnehmerzahl() {
Â* Â* Â* Â* if (document.new_veranstaltung.vanm.checked == true) {
Â* Â* Â* Â* Â* Â* Â* Â* document.new_veranstaltung.vteilz.disabled=true;
Â* Â* Â* Â* Â* Â* Â* Â* document.new_veranstaltung.vteilz.value="0";
Â* Â* Â* Â* } else {
Â* Â* Â* Â* Â* Â* Â* Â* document.new_veranstaltung.vteilz.disabled=false;
Â* Â* Â* Â* Â* Â* Â* Â* document.new_veranstaltung.vteilz.value="";
Â* Â* Â* Â* }
}
-----------------------------
When the "vanm" checkbox is being checked the text input "vteilz" should be
deactivated and become the value 0. By sending the form parameters to a php
script I'm getting for the variable $_POST['vteilz'] NULL instead of 0.
Can someone help me?

Thanks in advance

Apr 13 '07 #1
3 1901
On Fri, 13 Apr 2007 13:25:38 +0200, in comp.lang.javascript Todor
Vachkov <va*****@mail.math.tu-berlin.de>
<58*************@mid.dfncis.dewrote:
>| Dear all,
|
| here is the code:
| -----------------------------
| <tr>
| * * * * <td>ohne Anmeldung: </td>
| * * * * <td><input name="vanm" id="vanm" type="checkbox"
| onclick="DisableTeilnehmerzahl()"></td>
| </tr>
| <tr>
| * * * * <td>Max. Teilnehmerzahl: </td>
|
| * * * * <td><input name="vteilz" id="vteilz" type="text" size="1"
| maxlength="3"
| ></td>
| </tr>
| -----------------------------
| function DisableTeilnehmerzahl() {
| * * * * if (document.new_veranstaltung.vanm.checked == true) {
| * * * * * * * * document.new_veranstaltung.vteilz.disabled=true;
| * * * * * * * * document.new_veranstaltung.vteilz.value="0";
| * * * * } else {
| * * * * * * * * document.new_veranstaltung.vteilz.disabled=false;
| * * * * * * * * document.new_veranstaltung.vteilz.value="";
| * * * * }
| }
| -----------------------------
| When the "vanm" checkbox is being checked the text input "vteilz" should be
| deactivated and become the value 0. By sending the form parameters to a php
| script I'm getting for the variable $_POST['vteilz'] NULL instead of 0.
| Can someone help me?
|
| Thanks in advance
Disabled controls are not transmitted via the POST form command.
What you'll need to do is (in php):
vteilz = ( isset($_POST['vteilz']) ? $_POST['vteilz'] : 0;
---------------------------------------------------------------
jn******@yourpantsyahoo.com.au : Remove your pants to reply
---------------------------------------------------------------
Apr 13 '07 #2
On Apr 13, 6:25 pm, Todor Vachkov <vach...@mail.math.tu-berlin.de>
wrote:
-----------------------------
function DisableTeilnehmerzahl() {
if (document.new_veranstaltung.vanm.checked == true) {
document.new_veranstaltung.vteilz.disabled=true;
document.new_veranstaltung.vteilz.value="0";
} else {
document.new_veranstaltung.vteilz.disabled=false;
document.new_veranstaltung.vteilz.value="";
}}
To prevent changes, why don't you just change it to readonly?
The value is still submitted then.

Apr 13 '07 #3
Thanks a lot folks!
Now I figured out where was the problem;)

Apr 13 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Dan | last post by:
Can anyone offer suggestions on how to do this or if it is possible? I have a form that uses a drop down box and 2 text fields. What I am trying to do is have the value of each text box set by...
7
by: Marios Koumides | last post by:
I post the same question few days ago but there was a confusion in the answers. Anywayz I am posting again. I have a form with 96 textboxes (8 rows x 12 columns) Now I want in the last row to have...
3
by: JK | last post by:
This is an easy one, but I'm a JS newbie. I want to write a function that determines input value. If 0 - 100 than will use input as % (i.e., 3 would become .03 and used for calculations);...
12
by: Randell D. | last post by:
Folks, I have a form called "ourTestForm". Its a test form - nothing special - it contains five input tags - they are named one, two, three, four and five. The input tags are of type...
3
by: acecraig100 | last post by:
I am fairly new to Javascript. I have a form that users fill out to enter an animal to exhibit at a fair. Because we have no way of knowing, how many animals a user may enter, I created a table...
3
by: jonniethecodeprince | last post by:
Hi all, I have trouble getting an array of data stored in a separate javascript file i.e. a file called books.js into a table of data for a .xhtml file. There are 50 Records in this file....
4
by: hemricc2 | last post by:
I have the following simple page. I need to select the BARCODE text field everytime the page refreshes. I know this is pretty basic, but I'm just starting with Javascript. Thanks for the help. ...
4
cassbiz
by: cassbiz | last post by:
Could use some help here. This script is carrying over an image just fine but the text isn't coming over. can you see why it is not working???? from the form I want to carry over two lines of...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.