Jump to content

Weird Result


Pi_Mastuh

Recommended Posts

I'm making a script to let users customize the page. There's 4 select boxes but only 1 is showing up fully, anopther is showing up empty and the submit button isn't showing up. Does anyone know what's wrong?

[code]<?
session_start();
$session=session_id( );
include ("secure/config2.php");


$sql = "SELECT * from chibifriends where preuserID ='$preuserID'";
$result = mysql_query($sql, $connection);
$numShop = mysql_num_rows($result);
$query_data =mysql_fetch_array($result);
$bgColor = $query_data['bgColor'];
$fontColor = $query_data['fontColor'];
$boxColor = $query_data['boxColor'];
$boxbColor = $query_data['boxbColor'];
?>
<form method=post action=secure/luedit2.php>
  <p align="center">Modify Your Userlookup </p>
  <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="212" id="AutoNumber1" height="75" align=center>
    <tr>
      <td width="131" height="19" bgcolor="#000080" bordercolor="#FFFFFF" align="right"><font color="#FFFFFF">Background Color </font></td>
      <td width="75" height="19" bgcolor="#000080" bordercolor="#FFFFFF"><p align="left">
<select name='bgColor'>
<?php function select($bgColor, $type){if ($bgColor == $type) echo "selected=\"selected\"";}?>
<option value='White'<?php select($bgColor, "White");?>>White</option>
<option value='Black'<?php select($bgColor, "Black");?>>Black</option>
<option value='Blue'<?php select($bgColor, "Blue");?>>Blue</option>
<option value='Red'<?php select($bgColor, "Red");?>>Red</option>
<option value='Green'<?php select($bgColor, "Green");?>>Green</option>
<option value='Yellow'<?php select($bgColor, "Yellow");?>>Yellow</option>
</select>
      </td>
    </tr>
    <tr>
      <td width="131" height="15" bgcolor="#0066FF" bordercolor="#FFFFFF" align="right"><font color="#FFFFFF">Text Color</font></td>
      <td width="75" height="15" bgcolor="#0066FF" bordercolor="#FFFFFF"> <select name='fontColor'>
<?php  function select($fontColor, $type2){if ($fontColor == $type2) echo "selected=\"selected\"";}?>
<option value='White'<?php select($fontColor, "White");?>>White</option>
<option value='Black'<?php select($fontColor, "Black");?>>Black</option>
<option value='Blue'<?php select($fontColor, "Blue");?>>Blue</option>
<option value='Red'<?php select($fontColor, "Red");?>>Red</option>
<option value='Green'<?php select($fontColor, "Green");?>>Green</option>
<option value='Yellow'<?php select($fontColor, "Yellow");?>>Yellow</option>
</select></td>
    </tr>
    <tr>
      <td width="131" height="19" bgcolor="#000080" bordercolor="#FFFFFF" align="right"><font color="#FFFFFF">Table Color</font></td>
      <td width="75" height="19" bgcolor="#000080" bordercolor="#FFFFFF"> <select name='boxColor'>
<?php function select($boxColor, $type3){if ($boxColor == $type3) echo "selected=\"selected\"";}?>
<option value='White'<?php select($boxColor, "White");?>>White</option>
<option value='Black'<?php select($boxColor, "Black");?>>Black</option>
<option value='Blue'<?php select($boxColor, "Blue");?>>Blue</option>
<option value='Red'<?php select($boxColor, "Red");?>>Red</option>
<option value='Green'<?php select($boxColor, "Green");?>>Green</option>
<option value='Yellow'<?php select($boxColor, "Yellow");?>>Yellow</option>
</select></td>
    </tr>
    <tr>
      <td width="131" height="19" bgcolor="#0066FF" bordercolor="#FFFFFF" align="right"><font color="#FFFFFF">Table Border Color</font></td>
      <td width="75" height="19" bgcolor="#0066FF" bordercolor="#FFFFFF"> <select name='boxbColor'>
<?php function select($boxbColor, $type4){if ($boxbColor == $type4) echo "selected=\"selected\"";}?>
<option value='White'<?php select($boxbColor, "White");?>>White</option>
<option value='Black'<?php select($boxbColor, "Black");?>>Black</option>
<option value='Blue'<?php select($boxbColor, "Blue");?>>Blue</option>
<option value='Red'<?php select($boxbColor, "Red");?>>Red</option>
<option value='Green'<?php select($boxbColor, "Green");?>>Green</option>
<option value='Yellow'<?php select($boxbColor, "Yellow");?>>Yellow</option>
</select></td>
    </tr>
  </table>
      <p align=center><input type=submit value=Submit name=submit>
</form>
</p>[/code]
Link to comment
Share on other sites

Like so....


[code]<?

session_start ();

$session = session_id ();

include 'secure/config2.php';

$result = mysql_query ( "SELECT * from chibifriends where preuserID = '" . $preuserID . "'" ) or die ( 'Query Error: ' . mysql_error () );

$query_data = mysql_fetch_array ( $result );


function select ( $bgColor, $type )
{
if ( $bgColor == $type )
{
echo " selected='selected'";
}
}
?>
<form action='secure/luedit2.php' method='post'>
<p align='center'>Modify Your Userlookup</p>
<table border='1' cellpadding='0' cellspacing='0' style='border-collapse: collapse' bordercolor='#111111' width='212' id='AutoNumber1' height='75' align='center'>
<tr>
<td width='131' height='19' bgcolor='#000080' bordercolor='#FFFFFF' align='right'><font color='#FFFFFF'>Background Color </font></td>
<td width='75' height='19' bgcolor='#000080' bordercolor='#FFFFFF'>
<p align='left'>
<select name='bgColor'>
<option value='White'<?php select ( $query_data['bgColor'], 'White' );?>>White</option>
<option value='Black'<?php select ( $query_data['bgColor'], 'Black' );?>>Black</option>
<option value='Blue'<?php select ( $query_data['bgColor'], 'Blue' );?>>Blue</option>
<option value='Red'<?php select ( $query_data['bgColor'], 'Red' );?>>Red</option>
<option value='Green'<?php select ( $query_data['bgColor'], 'Green' );?>>Green</option>
<option value='Yellow'<?php select ( $query_data['bgColor'], 'Yellow' );?>>Yellow</option>
</select>
</p>
</td>
</tr>
<tr>
<td width='131' height='15' bgcolor='#0066FF' bordercolor='#FFFFFF' align='right'><font color='#FFFFFF'>Text Color</font></td>
<td width='75' height='15' bgcolor='#0066FF' bordercolor='#FFFFFF'>
<p align='left'>
<select name='fontColor'>
<option value='White'<?php select ( $query_data['fontColor'], 'White' );?>>White</option>
<option value='Black'<?php select ( $query_data['fontColor'], 'Black' );?>>Black</option>
<option value='Blue'<?php select ( $query_data['fontColor'], 'Blue' );?>>Blue</option>
<option value='Red'<?php select ( $query_data['fontColor'], 'Red' );?>>Red</option>
<option value='Green'<?php select ( $query_data['fontColor'], 'Green' );?>>Green</option>
<option value='Yellow'<?php select ( $query_data['fontColor'], 'Yellow' );?>>Yellow</option>
</select>
</p>
</td>
</tr>
<tr>
<td width='131' height='19' bgcolor='#000080' bordercolor='#FFFFFF' align='right'><font color='#FFFFFF'>Table Color</font></td>
<td width='75' height='19' bgcolor='#000080' bordercolor='#FFFFFF'>
<p align='left'>
<select name='boxColor'>
<option value='White'<?php select ( $query_data['boxColor'], 'White' );?>>White</option>
<option value='Black'<?php select ( $query_data['boxColor'], 'Black' );?>>Black</option>
<option value='Blue'<?php select ( $query_data['boxColor'], 'Blue' );?>>Blue</option>
<option value='Red'<?php select ( $query_data['boxColor'], 'Red' );?>>Red</option>
<option value='Green'<?php select ( $query_data['boxColor'], 'Green' );?>>Green</option>
<option value='Yellow'<?php select ( $query_data['boxColor'], 'Yellow' );?>>Yellow</option>
</select>
</p>
</td>
</tr>
<tr>
<td width='131' height='19' bgcolor='#0066FF' bordercolor='#FFFFFF' align='right'><font color='#FFFFFF'>Table Border Color</font></td>
<td width='75' height='19' bgcolor='#0066FF' bordercolor='#FFFFFF'>
<p align='left'>
<select name='boxbColor'>
<option value='White'<?php select ( $query_data['boxbColor'], 'White' );?>>White</option>
<option value='Black'<?php select ( $query_data['boxbColor'], 'Black' );?>>Black</option>
<option value='Blue'<?php select ( $query_data['boxbColor'], 'Blue' );?>>Blue</option>
<option value='Red'<?php select ( $query_data['boxbColor'], 'Red' );?>>Red</option>
<option value='Green'<?php select ( $query_data['boxbColor'], 'Green' );?>>Green</option>
<option value='Yellow'<?php select ( $query_data['boxbColor'], 'Yellow' );?>>Yellow</option>
</select>
</p>
</td>
</tr>
</table>
<p align='center'><input type='submit' name='submit' value='Submit' />
</form>
[/code]


printf
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.