Concatenate 2 strings in PHP in POST Data method

  • Profile Image
    Asked on September 26, 2014 at 07:15 PM

    If I have two fields that I want to merge, would the code be:

    $phonenumber = $_POST['field1'] ."-". $_POST['field2'];

    Then in my db this would appear in one column as 'field1' - 'field2'

    This is a re-post of a comment on How to send Submissions to Your MySQL Database Using PHP

  • Profile Image
    Answered on September 26, 2014 at 07:38 PM


    Yes, that is correct. The concatenation operator for PHP is  ('.') 

    I suggest you also check the PHP manual for proper syntax construction.

    Please inform us if you need further assistance.