| | |||||
| ||||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
| NamePros Regular Join Date: Apr 2005
Posts: 394
![]() ![]() | My next question (PHP) I am trying to get the "platforms" listed in my database to show up where "$platform" is at in the drop down box. Code: <?
include("config.php");
?>
<html>
<form method="post" action="cp_admin/submitgame.php">
<h3>Title:</h3>
<input type="text" NAME="title">
<h3>Description:</h3>
<textarea name="description" rows="10" cols="48"></textarea>
<h3>Platform:</h3>
<select name="platform">
<option value="$platform">
</select>
<br>
<br>
<INPUT TYPE="submit" name="submit" value="submit">
</form>
</html> |
| |
| | #2 (permalink) |
| NamePros Expert Join Date: Nov 2003 Location: Scotland
Posts: 5,069
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | $platform is not within php tags. It should be:- PHP Code:
__________________ Manage your portfolio using my new Domain Portfolio Management script. Securing Your Domain Name From Theft |
| |
| | THREAD STARTER #4 (permalink) |
| NamePros Regular Join Date: Apr 2005
Posts: 394
![]() ![]() | here is what I have now, I tried it with GET and POST - neither of the two work. Code: <?
include("config.php");
$platform = mysql_real_escape_string($_GET['platname']);
?>
<html>
<form method="post" action="cp_admin/submitgame.php">
<h3>Title:</h3>
<input type="text" NAME="title">
<h3>Description:</h3>
<textarea name="description" rows="10" cols="48"></textarea>
<h3>Platform:</h3>
<select name="platform">
<option value="<?PHP echo $platform ?>">
</select>
<br>
<br>
<INPUT TYPE="submit" name="submit" value="submit">
</form>
</html> I also tried this, and it does not work either: ????: NamePros.com http://www.namepros.com/programming/402651-resolved-my-next-question-php.html Code: <?
include("config.php");
$platform = $row['platname'];
while($row = mysql_fetch_array( $result )) {
$result = mysql_query("SELECT * FROM platform")
or die(mysql_error());
?>
<html>
<form method="post" action="cp_admin/submitgame.php">
<h3>Title:</h3>
<input type="text" NAME="title">
<h3>Description:</h3>
<textarea name="description" rows="10" cols="48"></textarea>
<h3>Platform:</h3>
<select name="platform">
<option value="<?PHP echo $row['platname']; ?>">
</select>
<br>
<br>
<INPUT TYPE="submit" name="submit" value="submit">
</form>
</html>
Last edited by flishess; 12-03-2007 at 11:50 AM.
|
| |
| | #5 (permalink) |
| NamePros Member Join Date: Nov 2003
Posts: 107
![]() | Code: $result = mysql_query("SELECT * FROM platform");
while ($row = mysql_fetch_assoc($result)) {
$platform = '<option value="' . $row['platname']. '">';
}
?>
<select name="platform">
<?php echo $platform; ?>
</select>
__________________ Complete Resource Management Script - Myspace / Social Network Layout and Graphic Script Online business lens - My personal experiences in internet business. |
| |
| | #7 (permalink) |
| NamePros Member Join Date: Nov 2003
Posts: 107
![]() | I actually forgot a pretty important part of that code Code: $platform = '<option value="' . $row['platname']. '">'; Code: $platform = '<option value="' . $row['platname']. '">' . $row['platname'] . '</option>';
__________________ Complete Resource Management Script - Myspace / Social Network Layout and Graphic Script Online business lens - My personal experiences in internet business. |
| |
| | #9 (permalink) |
| NamePros Member Join Date: Nov 2003
Posts: 107
![]() | try adding Code: $platform = '';
__________________ Complete Resource Management Script - Myspace / Social Network Layout and Graphic Script Online business lens - My personal experiences in internet business. |
| |
| | THREAD STARTER #10 (permalink) |
| NamePros Regular Join Date: Apr 2005
Posts: 394
![]() ![]() | Like, this: it didn't work... Code: $result = mysql_query("SELECT * FROM platform");
$platform = '';
while ($row = mysql_fetch_assoc($result)) {
$platform = '<option value="' . $row['platname']. '">';
}
?>
<select name="platform">
<?php echo $platform; ?>
</select> |
| |
| | #11 (permalink) |
| Senior Member Join Date: Aug 2005 Location: East Yorkshire, England
Posts: 2,689
![]() ![]() ![]() ![]() ![]() ![]() ![]() | Try this: PHP Code: |
| |
| | #13 (permalink) |
| NamePros Member Join Date: Nov 2003
Posts: 107
![]() | There we go, Thanks Mikor I knew I was missing a character somewhere
__________________ Complete Resource Management Script - Myspace / Social Network Layout and Graphic Script Online business lens - My personal experiences in internet business. |
| |