Jump to content

Parse Error For Select Menu


Xtremer360

Recommended Posts

Can someone tell me why I keep getting a error like this for my select drop down:

 

Parse error: parse error, unexpected T_STRING, expecting ',' or ';' in /home/content/y/a/n/yankeefaninkc/html/backstage/setupshow.php on line 15

 

<?php

/* setupshow.php */

/* This form after submission takes the results of the form and makes a new show ready for adding matches. */

require ('database.php');

echo '<form action="setupshow.php" method="post">';

echo '<fieldset>';
echo '<legend>Enter the following information to setup a show:</legend>';
echo '<p>Weekly Show or Pay-Per View:<select name="type" onChange="showShows(this.value)"><option value="">Select a Show Type</option>
<?php
      			$query = 'SELECT type FROM shows';
		while ($row = mysql_fetch_array($result, MYSQL_NUM)){
				echo "<option value=\"$row['type']\">$row['type']</option>\r";
			}			
			?></select></p>';

echo '<p>Show Name:<select name="type"><option></option></select></p>';
echo '<p>Show Label:<input name="showlabel" type="text" readonly="true" size="5"></p>';
echo '<p>Location:<input name="location" type="text"></p>';
echo '<p>Arena:<input name="arena" type="text"></p>';
echo '<div align="center"><input name="submit" type="submit"><input name="sumbitted" type="hidden" value="TRUE"></div>';
echo '</fieldset>';

echo '</form>';

?>

Link to comment
Share on other sites

echo '<p>Weekly Show or Pay-Per View:<select name="type" onChange="showShows(this.value)"><option value="">Select a Show Type</option>

<?php

 

See the problem, or problems?

 

I believe there are several others. You're escaping your PHP, but then continuing to enter PHP code, and you're missing semicolons.

Link to comment
Share on other sites

Parse error: parse error, unexpected T_STRING, expecting ',' or ';' in /home/content/y/a/n/yankeefaninkc/html/backstage/setupshow.php on line 15

 

<?php

 

/* setupshow.php */

 

/* This form after submission takes the results of the form and makes a new show ready for adding matches. */

 

require ('database.php');

 

echo '<form action="setupshow.php" method="post">';

 

echo '<fieldset>';

echo '<legend>Enter the following information to setup a show:</legend>';

echo '<p>Weekly Show or Pay-Per View:<select name="type" onChange="showShows(this.value)"><option value="">Select a Show Type</option>

 

      $query = 'SELECT type FROM shows';

while ($row = mysql_fetch_array($result, MYSQL_NUM)){

echo "<option value=\"$row['type']\">$row['type']</option>\r";

}

</select></p>';

 

echo '<p>Show Name:<select name="type"><option></option></select></p>';

echo '<p>Show Label:<input name="showlabel" type="text" readonly="true" size="5"></p>';

echo '<p>Location:<input name="location" type="text"></p>';

echo '<p>Arena:<input name="arena" type="text"></p>';

echo '<div align="center"><input name="submit" type="submit"><input name="sumbitted" type="hidden" value="TRUE"></div>';

echo '</fieldset>';

 

echo '</form>';

 

?>

Link to comment
Share on other sites

Yes, there is a semicolon at the END of that line, BUT you're missing one before it (it should go at the end of your line 13, but PHP is trying to tell you that you're missing one before the "$..." on line 15.

echo '<p>Weekly Show or Pay-Per View:<select name="type" onChange="showShows(this.value)"><option value="">Select a Show Type</option>

needs to be

echo '<p>Weekly Show or Pay-Per View:<select name="type" onChange="showShows(this.value)"><option value="">Select a Show Type</option>;

Link to comment
Share on other sites

Why so many errrors?

 

Parse error: parse error, unexpected T_STRING, expecting ',' or ';' in /home/content/y/a/n/yankeefaninkc/html/backstage/setupshow.php on line 14

 

<?php

/* setupshow.php */

/* This form after submission takes the results of the form and makes a new show ready for adding matches. */

require ('database.php');

echo '<form action="setupshow.php" method="post">';

echo '<fieldset>';
echo '<legend>Enter the following information to setup a show:</legend>';
echo '<p>Weekly Show or Pay-Per View:<select name="type" onChange="showShows(this.value)"><option value="">Select a Show Type</option>;
      			$query = 'SELECT type FROM shows';
		while ($row = mysql_fetch_array($result, MYSQL_NUM)){
				echo "<option value=\"$row['type']\">$row['type']</option>\r";
			}			
			</select></p>';

echo '<p>Show Name:<select name="type"><option></option></select></p>';
echo '<p>Show Label:<input name="showlabel" type="text" readonly="true" size="5"></p>';
echo '<p>Location:<input name="location" type="text"></p>';
echo '<p>Arena:<input name="arena" type="text"></p>';
echo '<div align="center"><input name="submit" type="submit"><input name="sumbitted" type="hidden" value="TRUE"></div>';
echo '</fieldset>';

echo '</form>';

?>

Link to comment
Share on other sites

That means that you're putting some variables and other things inside of a string improperly. For instance, in this code:

echo "<option value=\"$row['type']\">$row['type']</option>\r";

You can't use arrays in a double quoted string without {} brackets around them. So use:

echo "<option value=\"{$row['type']}\">{$row['type']}</option>\r";

Link to comment
Share on other sites

Now I can see the entire form. However the first select field will not show the different types of shows. Why coudl that be?

 

<?php

/* setupshow.php */

/* This form after submission takes the results of the form and makes a new show ready for adding matches. */

require ('database.php');

echo '<form action="setupshow.php" method="post">';

echo '<fieldset>';
echo '<legend>Enter the following information to setup a show:</legend>';
echo '<p>Weekly Show or Pay-Per View:<select name="type" onChange="showShows(this.value)"><option value="">Select a Show Type</option>';
      			$query = 'SELECT type FROM shows';
		while ($row = mysql_fetch_array($result, MYSQL_NUM)){
				echo "<option value=\"{$row['type']}\">{$row['type']}</option>\r";
			}			
			'</select></p>';

echo '<p>Show Name:<select name="type"><option></option></select></p>';
echo '<p>Show Label:<input name="showlabel" type="text" readonly="true" size="5"></p>';
echo '<p>Location:<input name="location" type="text"></p>';
echo '<p>Arena:<input name="arena" type="text"></p>';
echo '<div align="center"><input name="submit" type="submit"><input name="sumbitted" type="hidden" value="TRUE"></div>';
echo '</fieldset>';

echo '</form>';

?>

Link to comment
Share on other sites

This is my database.php file.

<?php 

// This script retrieves headline entries from the database.

// Address error handing. 
ini_set ('display_errors', 1);
error_reporting (E_ALL & ~E_NOTICE);

// Connect and select.
if ($dbc = @mysql_connect ('___', '___', '___')) {

if (!@mysql_select_db ('___')) {
	die ('<p>Could select the database because: <b>' . mysql_error() . '</b></p>');
}

} else {
die ('<p>Could not connect to MySQL because: <b>' . mysql_error() . '</b></p>');
}

if (get_magic_quotes_gpc()) {
    function stripslashes_deep($value)
    {
        $value = is_array($value) ?
                    array_map('stripslashes_deep', $value) :
                    stripslashes($value);

        return $value;
    }

    $_POST = array_map('stripslashes_deep', $_POST);
    $_GET = array_map('stripslashes_deep', $_GET);
    $_COOKIE = array_map('stripslashes_deep', $_COOKIE);
    $_REQUEST = array_map('stripslashes_deep', $_REQUEST);
}
?>

 

<?php

/* setupshow.php */

/* This form after submission takes the results of the form and makes a new show ready for adding matches. */

require ('database.php');

echo '<form action="setupshow.php" method="post">';

echo '<fieldset>';
echo '<legend>Enter the following information to setup a show:</legend>';
echo '<p>Weekly Show or Pay-Per View:<select name="type"><option value="">Select a Show Type</option>';
      			$query = 'SELECT type FROM shows';
		while ($row = mysql_fetch_assoc($result)){
				echo "<option value=\"{$row['type']}\">{$row['type']}</option>\r";
			}			
			'</select></p>';

echo '<p>Show Name:<select name="type"><option></option></select></p>';
echo '<p>Show Label:<input name="showlabel" type="text" readonly="true" size="5"></p>';
echo '<p>Location:<input name="location" type="text"></p>';
echo '<p>Arena:<input name="arena" type="text"></p>';
echo '<div align="center"><input name="submit" type="submit"><input name="sumbitted" type="hidden" value="TRUE"></div>';
echo '</fieldset>';

echo '</form>';

?>

Link to comment
Share on other sites

OMG! I can't believe I didn't see this. You're never running the query:

<?php
               $query = 'SELECT type FROM shows';
               $result = mysql_query($query);
         while ($row = mysql_fetch_assoc($result)){
?>

Link to comment
Share on other sites

Damn I didn't even notice that but thank you. Now I just have to figure out how to that select box to whatever the user selects it goes back to the database and selects all the show names with that type and then the show names in that second select box. I modified the code just a tad and don't know why it didn't drop the select box below like it should be.

 

http://kansasoutlawwrestling.com/backstage/setupshow.php

 

<?php

/* setupshow.php */

/* This form after submission takes the results of the form and makes a new show ready for adding matches. */

require ('database.php');

echo '<form action="setupshow.php" method="post">';

echo '<fieldset>';
echo '<legend>Enter the following information to setup a show:</legend>';
echo '<p>Weekly Show or Pay-Per View:<select name="type"><option value="">Select a Show Type</option>';
      			$query = 'SELECT type FROM shows';
			$result = mysql_query($query);
		while ($row = mysql_fetch_assoc($result)){
				echo "<option value=\"{$row['type']}\">{$row['type']}</option>\r";
			}			
			'</select></p>';
echo '<p>Show Name:<select name="showname"><option>Select a Show Name</option></select></p>';
echo '<p>Show Label:<input name="showlabel" type="text" readonly="true" size="5"></p>';
echo '<p>Location:<input name="location" type="text"></p>';
echo '<p>Arena:<input name="arena" type="text"></p>';
echo '<div align="center"><input name="submit" type="submit"><input name="sumbitted" type="hidden" value="TRUE"></div>';
echo '</fieldset>';

echo '</form>';

?>

Link to comment
Share on other sites

Well, since you're posting in the AJAX board, I'm sure you want to use AJAX to do this. It can be done, but do you have any experience with AJAX? What about JavaScript? Looking at your page, you do not have any JS code.

 

I suggest either going through a tutorial on this page, or go to http://w3schools.com and click on JavaScript and/or AJAX and learn how to use them.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.