Jump to content


Photo

Using a form to make a variable


  • Please log in to reply
2 replies to this topic

#1 megamanhero

megamanhero
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 05 September 2006 - 11:43 AM

UPDATE Users SET Rank = 'Form_Variable' WHERE Rank = 'form_variable' AND User = 'Form_variable'

does anyone know how to use a form to be submitted to create a variable for the above

#2 shocker-z

shocker-z
  • Members
  • PipPipPip
  • Advanced Member
  • 864 posts
  • LocationNottingham

Posted 05 September 2006 - 11:53 AM

well if form uses method="post" then it's $_POST['form_variable_name_here'] if it's method="get" then it's $_GET['form_variable_name_here']... what you also need to do it make an effort to stop someone SQL injecting your page so your could should be like this..

$variablename=mysql_real_escape_string($_POST['variablename']);

UPDATE Users SET Rank = 'Form_Variable' WHERE Rank = 'form_variable' AND User = '$variablename'


regards
Liam
www: www.ukchat.ws | irc: irc.ukchat.ws chan: #blufudge

#3 megamanhero

megamanhero
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 05 September 2006 - 12:26 PM

Thanx for the help




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users