Hi

I am trying to create an address book as part of my studying PHP. I have tried to create some radio buttons to select family friends work etc.

<table border="0" cellpadding="0" cellspacing="5" style="border-collapse: collapse"
bordercolor="#0000FF" id="AutoNumber2">
<td width = "150px" align="right">Category :</td>
<td width = "80px" ><input type ="radio" name=\"cat_type\" value = \'family\"> Family</td>
<td width = "80px" ><input type ='radio' name='cat_type\' value = \'friends\"> Friends</td>
<td width = "80px" ><input type ='radio' name='cat_type\' value = \'work\"> Work</td>
<td width = "80px" ><input type ='radio' name='cat_type\' value = \'services\"> Services</td>
<td width = "100px" ><input type ='radio' name='cat_type\' value = \'commerce\"> Commerce</td>
</table>

When I run this I receive the following error:

Data truncated for column 'category' at row 1

Could somebody please tell me what this means and where I have gone wrong?

Many Thanks

    
    ............
    ............
    <body>
    <?
    if($_POST["radiobutton"])
    print $_POST["radiobutton"] . " is the selected button";
    ?>
    <form name="form1" method="post" action="?">
    Value1<br><input name="radiobutton" type="radio" value="value1">
    VAlue2<br><input name="radiobutton" type="radio" value="value2">
    <input type="submit" name="Submit" value="Submit">
    </form>
    </body>
    ...........
    ..........
    
    DJH;10891802 wrote:

    Hi

    I am trying to create an address book as part of my studying PHP. I have tried to create some radio buttons to select family friends work etc.

    <table border="0" cellpadding="0" cellspacing="5" style="border-collapse: collapse"
    bordercolor="#0000FF" id="AutoNumber2">
    <td width = "150px" align="right">Category :</td>
    <td width = "80px" ><input type ="radio" name=\"cat_type\" value = \'family\"> Family</td>
    <td width = "80px" ><input type ='radio' name='cat_type\' value = \'friends\"> Friends</td>
    <td width = "80px" ><input type ='radio' name='cat_type\' value = \'work\"> Work</td>
    <td width = "80px" ><input type ='radio' name='cat_type\' value = \'services\"> Services</td>
    <td width = "100px" ><input type ='radio' name='cat_type\' value = \'commerce\"> Commerce</td>
    </table>

    When I run this I receive the following error:

    Data truncated for column 'category' at row 1

    Could somebody please tell me what this means and where I have gone wrong?

    Many Thanks

      Sounds like a database query error. Either you are trying to insert/update the wrong type of data into the "category" column of the database table in question, or you have not defined the column correctly for the type/size of data you want to enter into it.

        What if he create a query with this broken radiobutton:

        value = \'family\"

        that could not able to create a query error ?

        NogDog;10891850 wrote:

        Sounds like a database query error. Either you are trying to insert/update the wrong type of data into the "category" column of the database table in question, or you have not defined the column correctly for the type/size of data you want to enter into it.

          djjjozsi;10891851 wrote:

          What if he create a query with this broken radiobutton:

          value = \'family\"

          that could not able to create a query error ?

          There's certainly something wrong there that needs to be fixed. It's not immediately apparent from the limited code snippet provided in the original post as to why the quotes are being escaped in the first place, and obviously there's a mismatch between single- and double-quotes for the value attributes. Whether or not that is the cause of the database error is unknown (to me) at this point, but it definitely needs fixing in any case.

            Write a Reply...