Record Mysql PHP Radio Button

Asked

Viewed 298 times

0

I have a system in PHP, Javascript and MYSQL where the person assembles your request...

Link to the website

It’s working properly, but I need to pass data to a report and I don’t know how to do it...

Ex. Size 06x08 - Oval - Frameless...

In the radio input of each item the value is set with the value of each piece.

So I can not pass via POST or GET what is the customer’s choice...

He gives me only the values

Ex. of a radio input

<input type="radio" value="10.00" name="moldura" id="btn_medida02_oval_sm">
  • The only value passed via POST/GET is the attribute value associated with name field. What other value would you expect to pass?

  • I want to pass the name of the selected item... Ex: Size 06x08cm. The value assigned to it in value comes from the database

  • There is how I pass the price, without using the value of the radio button?

  • What information you need to send, in fact?

1 answer

1


There is how I pass the price, without using the value of the radio button?

Create an input to type Hidden, or multiple if it becomes easier to understand.

<input type="hidden" name="campo_oculto" value="">

And in the click event you add the values in the Hidden input.

Where you want to place the click event you add an id, below the tag you imported the jquery add the following code:

$(function(){
    $('#id_onde_vc_clica').click(function(){
        $('#id_do_campo_hidden').val($('#id_onde_esta_o_valor').val());
    });
});

If the value is like this, inside the value attribute:

<input type="hidden" name="campo_oculto" id="teste" value="informacao aqui">

You use the val to get the value

$('#teste').val();

But if the value is this way:

<span id="teste">informacao aqui</span>

You use text to get the value:

$('#teste').text();
  • how would I add this in click? I could not

  • I made an edition with a small example.

  • Cool... I did the tests here and it was... but how to send only the ones I selected.... Size 1 - Format 1 - Frame 2... In this case going all formats (1 and 2) and all Frames (1 and 2). Not only the ones I selected

  • Thus it returns whether it is arrived or not $("#id_do_radio"). is(':checked')

Browser other questions tagged

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