Note that there are some explanatory texts on larger screens.

plurals
  1. POwhat is the point of escaping quotation marks in php
    primarykey
    data
    text
    <p>Here is a validation script from a book I am learning, Why is escaping the quotation marks necassery? e.g. <code>&lt;option value=\"char\"&gt;char&lt;/option&gt;</code></p> <pre><code>&lt;?php //validate important input if ((!$_POST[table_name]) || (!$_POST[num_fields])) { header( "location: show_createtable.html"); exit; } //begin creating form for display $form_block = " &lt;form action=\"do_createtable.php\" method=\"post\"&gt; &lt;input name=\"table_name\" type=\"hidden\" value=\"$_POST[table_name]\"&gt; &lt;table cellspacing=\"5\" cellpadding=\"5\"&gt; &lt;tr&gt; &lt;th&gt;Field Name&lt;/th&gt;&lt;th&gt;Field Type&lt;/th&gt;&lt;th&gt;Table Length&lt;/th&gt; &lt;/tr&gt;"; //count from 0 until you reach the number fo fields for ($i = 0; $i &lt;$_POST[num_fields]; $i++) { $form_block .=" &lt;tr&gt; &lt;td align=center&gt;&lt;input type=\"texr\" name=\"field name[]\" size=\"30\"&gt;&lt;/td&gt; &lt;td align=center&gt; &lt;select name=\"field_type[]\"&gt; &lt;option value=\"char\"&gt;char&lt;/option&gt; &lt;option value=\"date\"&gt;date&lt;/option&gt; &lt;option value=\"float\"&gt;float&lt;/option&gt; &lt;option value=\"int\"&gt;int&lt;/option&gt; &lt;option value=\"text\"&gt;text&lt;/option&gt; &lt;option value=\"varchar\"&gt;varchar&lt;/option&gt; &lt;/select&gt; &lt;/td&gt; &lt;td align=center&gt;&lt;input type=\"text\" name=\"field_length[]\" size=\"5\"&gt; &lt;/td&gt; &lt;/tr&gt;"; } //finish up the form $form_block .= " &lt;tr&gt; &lt;td align=center colspan=3&gt;&lt;input type =\"submit\" value=\"create table\"&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/form&gt;"; ?&gt; &lt;html&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt; &lt;title&gt;Create a database table: Step 2&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;h1&gt;defnie fields for &lt;? echo "$_POST[table_name]"; ?&gt; &lt;/h1&gt; &lt;? echo "$form_block"; ?&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload