Jump to content
MakeWebGames

Recommended Posts

Posted

hey i recently added a color change method for donators, i added username_color to the user SQL table

here are the username color cases in preferences.php

case 'colorchange2': 
do_color_change(); 
break; 

case 'colorchange': 
color_change(); 
break;

and here is the code...

function color_change() 
{ 
global $ir,$c,$userid,$h; 
print "<h3>Change Name Color</h3> 
Below are a list of colors in which you can change your name to with an example of each....

<form action='preferences.php?action=colorchange2' method='post'> 
Color: <select name='color' type='dropdown'> 
<option value='lime'>None
<option value='red'>RED
<option value='blue'>BLUE
<option value='green'>GREEN
<input type='submit' value='Change color' /></form>"; 
} 
function do_color_change() 
{ 
global $db,$ir,$c,$userid,$h; 
if($_POST['color'] == none) { 
$color = lime; 
} 
if($_POST['color'] == red) { 
$color = red; 
} 
if($_POST['color'] == blue) { 
$color = blue; 
} 
if($_POST['color'] == green) { 
$color = green; 
} 
$db->query("UPDATE users SET username_color=$color WHERE userid=$userid"); 
print "Name Color Changed!"; 
}

and this happens :

xnydz9.png

is there a way of adding a button to it so it can submit the info to the database? please help! i really need a button to submit the info the the database but i got no idea how to do it :( thank you!

Posted

i got a error

QUERY ERROR: Unknown column 'red' in 'field list'

Query was UPDATE users SET username_color=red WHERE userid=1

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.   Paste as plain text instead

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