hi guys.. i have a problem..
what i want is..i have a form with 2 textfield. i want the value after we insert data into it..the data will insert into database in one column..but how to do it?sory for my bad english..:'(

my code:

<td bgcolor="#A4DDED"> <strong>DL</strong>  
     <input name="NF1" type="text" size="10" id="NF1" />
     <strong> / </strong>
     <label>
     <input name="Y2" type="text" id="Y2" size="10" />
     </label></td>

HERE PIC WILL BE LIKE THIS:

Recommended Answers

All 3 Replies

you can concatenate the two values with php

Example:

$val1 = $_POST['NF1'];
$val2 = $_POST['Y2'];


    $total_value = $val1 . $val2;

    $sql = "INSERT INTO table SET column = '$total_value'"; 

you can concatenate the two values with php

Example:

$val1 = $_POST['NF1'];
$val2 = $_POST['Y2'];


    $total_value = $val1 . $val2;

    $sql = "INSERT INTO table SET column = '$total_value'"; 

Just like gabrielcastillo said - concatenate them in php after the post before your insert. However you may want to add a space or use the slash you are displaying inbetween the fields on the form.

$val1 = $_POST['NF1'];
$val2 = $_POST['Y2'];


    $total_value = $val1 . "/" . $val2;

    $sql = "INSERT INTO `table` SET `column` = '$total_value'"; 

OR

$val1 = $_POST['NF1'];
$val2 = $_POST['Y2'];


    $total_value = $val1 . " " . $val2;

    $sql = "INSERT INTO `table` SET `column` = '$total_value'"; 
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.