Only first word In a multi word variable is being displayed

前端 未结 3 442
遇见更好的自我
遇见更好的自我 2020-12-06 21:45

In my form I have the following values that are based on a standard PHP/MySql query.

echo \"\\n
        Locati         


        
相关标签:
3条回答
  • 2020-12-06 22:02

    You forgot quotes :

    echo "<tr>\n
        <td align='right'><b>Location</b></td>
        <td><input name='student_location' type='text' size='25' style='font-weight: 700' value=\"$location\"></td>
    </tr>";
    

    Without quotes, the first word will be noted, others will be interpreted as wrong attributes.

    0 讨论(0)
  • 2020-12-06 22:18

    you need to quote it by escaping the "

    echo "<tr>\n
            <td align='right'><b>Location</b></td>
            <td><input name='student_location' type='text' size='25' style='font-weight: 700' value=\"$location\"></td>
        </tr>";
    
    0 讨论(0)
  • 2020-12-06 22:28

    You need to put your single quotes around it to make it a valid attribute. The HTML is being created as value=North Campus which gets interpreted as value="North" and some Campus attribute that has no value. Use value='$location'.

    0 讨论(0)
提交回复
热议问题