0

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:

Edited by Keyra Lee

Attachments Capture.JPG 9.5 KB
3
Contributors
3
Replies
20
Views
3 Years
Discussion Span
Last Post by Casperjames
1

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'"; 
0

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'"; 
1

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'"; 
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.