radio button to php
Posted
by Azzyh
on Stack Overflow
See other posts from Stack Overflow
or by Azzyh
Published on 2010-06-12T22:12:01Z
Indexed on
2010/06/12
22:22 UTC
Read the original article
Hit count: 402
php
|radiobutton
Hello so i have this form:
<form action="javascript:DoSCInsert()" method="post">
<textarea onfocus="this.cleared=true;javascript:clearContents(this);" rows="5" cols="40" id="comment" name="comment">...</textarea>
Yes: <input type="radio" value="Y" id="SCvoteY" name="vote"></input> No: <input type="radio" id="SCvoteN" value="N" name="vote"> </input>
<input type="hidden" name="fID" id="fID" value="<? echo $_GET["id"]; ?>" />
<input onsubmit="if (!this.comment.cleared) clearContent(this.comment); return true;" type="submit" name="Submit" value="Stem!"/>
</form>
Anyway so i have this javascript also that tranfers the output info to insertSC.php:
function DoSCInsert(){
$("#SCres").html("to sek..");
var nocache = '0';
var data = { fID : $("#fID").val(), SCvote : $("#SCvoteY").val(), SCvote : $("#SCvoteN").val(), comment: $("#comment").val(), nocache: nocache };
$.get('insertSC.php', data, onSCInsertComplete);
}
function onSCInsertComplete(data,textstatus){
$("#SCres").html(data);
}
and in my insertSC.php i have this:
<?php
echo $_GET['comment']." - ".$_GET['SCvoteY'];
?>
Now i get out comment but no SCvoteY.... this is just a test i made, what i was really making is that you vote Y or N and then it inserts into the vote column Y or N(what you pickd) now i couldnt figure how to do it/something went wrong somewhere and now i cant even get out SCvoteY i just get undefined index
What i need help with is what i just mention i want to when you either choose Y or N it should output what you choose. If you didnt choose any (empty isset?) then false.. else echo Y or N(what you picked)
© Stack Overflow or respective owner