php - How to input value from buttons and checkboxes to textarea -
I have looked around the site, but I have not got anything I want. Anyway, I'm a self-taught HTML / CSS person most of my experience is using Wordpress, but by any means, I'm trying to create an interactive site (unfortunately not in WordPress), which is a large set of code Uses the form to make.
& lt; Form id = "drawing" & gt; & Lt; Input type = "radio" name = "draw" value = "normal" & gt; General & lt; Br / & gt; & Lt; Input type = "radio" name = "draw" value = "custom" & gt; Custom & lt; Br / & gt; & Lt; / Form & gt; & Lt; Input type = "submit" value = "print code" & gt; & Lt; Br / & gt; & Lt; Text area & gt; & Lt; / Text field & gt;
I want to print the text taken from the radio button in text in this manner: Droppie = (here the value),
What is the easiest, lighter? The way to go about? I have seen this topic: but is there an easy way to do this? I did not have much experience with PHP, so I'm asking this. If there is one more answer that I have not given attention, it would be good to be redirected to it. (Especially this is my first question.)
Thank you.
SidNote: & lt; Input type = "submit" value = "print code" & gt; & Lt; Br / & gt;
Currently & lt; Form & gt; & Lt; / Form & gt;
tag, so it will not be executed.
An original sample: (all in one file example)
A slightly different way:
& lt ;? Php if (isset ($ _ POST ['submit']) | empty ($ _ POST ['draw']) {if (empty ($ _ POST ['draw'])) {resonant "select." ; } $ Draw = $ _POST ['draw']; }? & Gt; & Lt; Form id = "drawing" action = "" method = "post" & gt; & Lt; Input type = "radio" name = "draw" value = "normal" & gt; General & lt; Br / & gt; & Lt; Input type = "radio" name = "draw" value = "custom" & gt; Custom & lt; Br / & gt; & Lt; Input type = "submit" name = "submit" value = "print code" & gt; & Lt; Br / & gt; & Lt; / Form & gt; & Lt; Textarea & gt; & Lt ;? Php ek $ _POST ['draw']; ? & Gt; & Lt; / Text field & gt;
Edit
Here is a jQuery method, yet I'm not sure that this is the desired effect:
& Lt ;? Php if (isset ($ _ POST ['submit']) {$ draw = $ _POST ['Draw'];}? & Gt; & gt; DOCTYPE html & gt; Top & gt; & lt; Script src = "http://code.jquery.com/jquery-1.9.1.js" & gt; & lt; / script & gt; & lt; / head & gt; & lt; body & gt; & lt ; Script & gt; $ (document) .ready (function () {var player = "& lt ;? php echo $ _POST ['draw'] ;? & gt;"; // alert (player);}); & Lt; / script & gt; Your choice: & lt; span id = 'draw' & gt; & lt ;? php echo $ _POST ['draw']? & Gt; & lt; ; / Div> & lt; form id = "drawing" action = "" method = "post" & gt; & lt; input type = "radio" name = "draw" value = "normal" & gt; normal
Input Type = "Radio" name = "d "Value" = "custom"> custom
If selecting General
, then the source of the script will appear in this form:
& lt; Script & gt; $ (Document) .ready (function () {var player = "normal"; // alert (player);}); & Lt; / Script & gt;
Comments
Post a Comment