Hai folks, the 12 and 13 lines are having a syntax issue. but i could not figure it out. pls help me. <?php echo "<select name=" . $select_name . " id=" . $select_id . ">"; echo "<option value="Select">Select</option>"; require_once('../includes/connection.php'); $query="SELECT * FROM " . $table . " ORDER BY " . $order_column . " ASC"; if ($result=mysql_query($query) or die (mysql_error())); while($row=mysql_fetch_array($result)){ $value=$row['" . $value_column . "']; //xxxx $name=$row['" . $name_column . "'];//xxxx echo "<option value='" . $value . "'>" . $name . "</option>"; } echo "</select>": ?> PHP:
Hi on line 3 you have to escape the double quotes inside double quotes with back slash or alternate with single quotes echo "<option value=\"Select\">Select</option>"; or echo "<option value='Select'>Select</option>"; and replace the colon with semicolon on the last line.
Thanks homer7 , i fixed it. but what about line 12 and 13 (in my first post) <?php echo "<select name='" . $select_name . "' id='" . $select_id . "'>"; echo "<option value='Select'>Select</option>"; require_once('../includes/connection.php'); $query="SELECT * FROM " . $table . " ORDER BY " . $order_column . " ASC"; if ($result=mysql_query($query) or die (mysql_error())); while($row=mysql_fetch_array($result)){ $value=$row['" . $value_column . "']; $name=$row['" . $name_column . "']; echo "<option value='" . $value . "'>" . $name . "</option>"; } echo "</select>": ?> PHP:
Would also be wise to just suggest using single quotes for the echo statements, so you don't have to escape anything, like so: echo '<p class="something">This is a text</p>'; //or echo '<p class="something">'.$this_is_a_variable.'</p>'; PHP: