Like me Seto a value of a radio in jquery for php

Asked

Viewed 38 times

0

The code to watch the radio is this

//Começo para mostrar a carta 1 do jogador 1
        var $carta1 = $("<td align='left' valign='top' nowrap='nowrap'>Carta1</td>");
        $(".carta1").append($carta1);   

//Começo do Ajax da carta que vai mostrar numero 1                  
         $.ajax({
                    type: "POST",
                    url: "carta1.php",
                    data: {data:novacarta},
                    success: function(html) {    
                    $(".carta1_1").append(html);      
                    }
                    });
//Fim do Ajax que vai mostrar carta numero 1
//Fim da mostra da carta 1 do jogdor 1

the code of the card 1.php is this one

include ('../../../../funcoes/conexao.php');
$sqlCartas = "SELECT * FROM maos";
$resultado = mysql_query($sqlCartas) or die (mysql_error());

$carta = $_POST["data"];

<td><input type="radio" name="carta1" id="radio49" value="ac.gif" /></td>
    <td><img src="../../../../img/cartas/ac.gif" width="35" height="47" /></td>
    <td><input type="radio" name="carta1" id="radio50" value="ao.gif" /></td>
    <td><img src="../../../../img/cartas/ao.gif" width="35" height="47" /></td>
    <td><input type="radio" name="carta1" id="radio51" value="ap.gif" /></td>
    <td><img src="../../../../img/cartas/ap.gif" width="35" height="47" /></td>
    <td><input type="radio" name="carta1" id="radio52" value="as.gif" /></td>
    <td><img src="../../../../img/cartas/As.gif" width="35" height="47" /></td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td width="3%"><input type="radio" name="carta1" id="radio" value="2c.gif" /></td>
    <td width="6%"><img src="../../../../img/cartas/2c.gif" width="35" height="47" /></td>
    <td width="3%"><input type="radio" name="carta1" id="radio2" value="2o.gif" /></td>
    <td width="6%"><img src="../../../../img/cartas/2o.gif" width="35" height="47" /></td>
    <td width="3%"><input type="radio" name="carta1" id="radio3" value="2p.gif" /></td>
    <td width="6%"><img src="../../../../img/cartas/2p.gif" width="35" height="47" /></td>
    <td width="3%"><input type="radio" name="carta1" id="radio4" value="2s.gif" /></td>
    <td width="6%"><img src="../../../../img/cartas/2s.gif" width="35" height="47" /></td>
    <td width="3%"><input type="radio" name="carta1" id="radio5" value="3c.gif" /></td>
    <td width="6%"><img src="../../../../img/cartas/3c.gif" width="35" height="47" /></td>
    <td width="3%"><input type="radio" name="carta1" id="radio6" value="3o.gif" /></td>
    <td width="6%"><img src="../../../../img/cartas/3o.gif" width="35" height="47" /></td>
    <td width="3%"><input type="radio" name="carta1" id="radio7" value="3p.gif" /></td>
    <td width="6%"><img src="../../../../img/cartas/3p.gif" width="35" height="47" /></td>
    <td width="3%"><input type="radio" name="carta1" id="radio8" value="3s.gif" /></td>
    <td><img src="../../../../img/cartas/3s.gif" width="35" height="47" /></td>
  </tr>
  <tr>
    <td><input type="radio" name="carta1" id="radio9" value="4c.gif" /></td>
    <td><img src="../../../../img/cartas/4c.gif" width="35" height="47" /></td>
    <td><input type="radio" name="carta1" id="radio10" value="4o.gif" /></td>
    <td><img src="../../../../img/cartas/4o.gif" width="35" height="47" /></td>
    <td><input type="radio" name="carta1" id="radio11" value="4p.gif" /></td>
    <td><img src="../../../../img/cartas/4p.gif" width="35" height="47" /></td>
    <td><input type="radio" name="carta1" id="radio12" value="4s.gif" /></td>
    <td><img src="../../../../img/cartas/4s.gif" width="35" height="47" /></td>
    <td><input type="radio" name="carta1" id="radio13" value="5c.gif" /></td>
    <td><img src="../../../../img/cartas/5c.gif" width="35" height="47" /></td>
    <td><input type="radio" name="radio" id="radio14" value="5o.gif" /></td>
    <td><img src="../../../../img/cartas/5o.gif" width="35" height="47" /></td>
    <td><input type="radio" name="carta1" id="radio15" value="5p.gif" /></td>
    <td><img src="../../../../img/cartas/5p.gif" width="35" height="47" /></td>
    <td><input type="radio" name="carta1" id="radio16" value="5s" /></td>
    <td><img src="../../../../img/cartas/5s.gif" width="35" height="47" /></td>
  </tr>
  <tr>
    <td><input type="radio" name="carta1" id="radio17" value="6c.gif" /></td>
    <td><img src="../../../../img/cartas/6c.gif" width="35" height="47" /></td>
    <td><input type="radio" name="carta1" id="radio18" value="6o.gif" /></td>
    <td><img src="../../../../img/cartas/6o.gif" width="35" height="47" /></td>
    <td><input type="radio" name="carta1" id="radio19" value="6p.gif" /></td>
    <td><img src="../../../../img/cartas/6p.gif" width="35" height="47" /></td>
    <td><input type="radio" name="radio" id="radio20" value="6s.gif" /></td>
    <td><img src="../../../../img/cartas/6s.gif" width="35" height="47" /></td>
    <td><input type="radio" name="carta1" id="radio21" value="7c.gif" /></td>
    <td><img src="../../../../img/cartas/7c.gif" width="35" height="47" /></td>
    <td><input type="radio" name="carta1" id="radio22" value="7o.gif" /></td>
    <td><img src="../../../../img/cartas/7o.gif" width="35" height="47" /></td>
    <td><input type="radio" name="carta1" id="radio23" value="7p.gif" /></td>
    <td><img src="../../../../img/cartas/7p.gif" width="35" height="47" /></td>
    <td><input type="radio" name="radio" id="radio24" value="7s.gif" /></td>
    <td><img src="../../../../img/cartas/7s.gif" width="35" height="47" /></td>
  </tr>
  <tr>
    <td><input type="radio" name="carta1" id="radio25" value="8c.gif" /></td>
    <td><img src="../../../../img/cartas/8c.gif" width="35" height="47" /></td>
    <td><input type="radio" name="carta1" id="radio26" value="8o.gif" /></td>
    <td><img src="../../../../img/cartas/8o.gif" width="35" height="47" /></td>
    <td><input type="radio" name="carta1" id="radio27" value="8c.gif" /></td>
    <td><img src="../../../../img/cartas/8p.gif" width="35" height="47" /></td>
    <td><input type="radio" name="carta1" id="radio28" value="8s.gif" /></td>
    <td><img src="../../../../img/cartas/8s.gif" width="35" height="47" /></td>
    <td><input type="radio" name="carta1" id="radio29" value="9c.gif" /></td>
    <td><img src="../../../../img/cartas/9c.gif" width="35" height="47" /></td>
    <td><input type="radio" name="carta1" id="radio30" value="9o.gif" /></td>
    <td><img src="../../../../img/cartas/9o.gif" width="35" height="47" /></td>
    <td><input type="radio" name="carta1" id="radio31" value="9p.gif" /></td>
    <td><img src="../../../../img/cartas/9p.gif" width="35" height="47" /></td>
    <td><input type="radio" name="carta1" id="radio32" value="9s.gif" /></td>
    <td><img src="../../../../img/cartas/9s.gif" width="35" height="47" /></td>
  </tr>
  <tr>
    <td><input type="radio" name="carta1" id="radio33" value="10c.gif" /></td>
    <td><img src="../../../../img/cartas/10c.gif" width="35" height="47" /></td>
    <td><input type="radio" name="carta1" id="radio34" value="10o.gif" /></td>
    <td><img src="../../../../img/cartas/10o.gif" width="35" height="47" /></td>
    <td><input type="radio" name="carta1" id="radio35" value="10p.gif" /></td>
    <td><img src="../../../../img/cartas/10p.gif" width="35" height="47" /></td>
    <td><input type="radio" name="carta1" id="radio36" value="10s.gif" /></td>
    <td><img src="../../../../img/cartas/10s.gif" width="35" height="47" /></td>
    <td><input type="radio" name="carta1" id="radio37" value="jc.gif" /></td>
    <td><img src="../../../../img/cartas/jc.gif" width="35" height="47" /></td>
    <td><input type="radio" name="carta1" id="radio38" value="jo.gif" /></td>
    <td><img src="../../../../img/cartas/jo.gif" width="35" height="47" /></td>
    <td><input type="radio" name="carta1" id="radio39" value="jp.gif" /></td>
    <td><img src="../../../../img/cartas/jp.gif" width="35" height="47" /></td>
    <td><input type="radio" name="carta1" id="radio40" value="js.gif" /></td>
    <td><img src="../../../../img/cartas/js.gif" width="35" height="47" /></td>
  </tr>
  <tr>
    <td><input type="radio" name="carta1" id="radio41" value="qc.gif" /></td>
    <td><img src="../../../../img/cartas/qc.gif" width="35" height="47" /></td>
    <td><input type="radio" name="carta1" id="radio42" value="qo.gif" /></td>
    <td><img src="../../../../img/cartas/qo.gif" width="35" height="47" /></td>
    <td><input type="radio" name="carta1" id="radio43" value="qp.gif" /></td>
    <td><img src="../../../../img/cartas/qp.gif" width="35" height="47" /></td>
    <td><input type="radio" name="carta1" id="radio44" value="qs.gif" /></td>
    <td><img src="../../../../img/cartas/qs.gif" width="35" height="47" /></td>
    <td><input type="radio" name="carta1" id="radio45" value="kc.gif" /></td>
    <td><img src="../../../../img/cartas/kc.gif" width="35" height="47" /></td>
    <td><input type="radio" name="carta1" id="radio46" value="ko.gif" /></td>
    <td><img src="../../../../img/cartas/ko.gif" width="35" height="47" /></td>
    <td><input type="radio" name="carta1" id="radio47" value="kp.gif" /></td>
    <td><img src="../../../../img/cartas/kp.gif" width="35" height="47" /></td>
    <td><input type="radio" name="carta1" id="radio48" value="ks.gif" /></td>
    <td><img src="../../../../img/cartas/ks.gif" width="35" height="47" /></td
  • To set an attribute value in the jQuery is $("elemento").val("valor");. However I don’t understand where you want to set the attribute value.

  • missing a PHP closing tag ?> after $carta = $_POST["data"];

  • I Jah closed Jah....

  • I only want one thing, I want to pass the value of radio to php... how I do it?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.