1

What i'm looking to do is have 3 text boxes with a submit button so when i enter a username in each box that username becomes a value that i can use in this line of code:

<!-- IF S_USERNAME eq "{value1}" or S_USERNAME eq "{value2}" or S_USERNAME eq "{value3}" -->

I'm sure this is quite simple, but i can't seem to do it?

4
  • That's not php or html... is this something like a phpbb template? Commented Jan 27, 2011 at 16:32
  • @JohnB it's correct HTML. Or XML, XHTML, XSL, SVG or any superset of XML. Commented Jan 27, 2011 at 16:34
  • The value needs to be set to the sql database so it can be called on by that value tag. Commented Jan 27, 2011 at 16:36
  • Yes is is part of a phpbb3 template file, you are correct Commented Jan 27, 2011 at 16:37

1 Answer 1

1

I do not exactly understand what you want. But one thing first: PHP is made before thepage shows. So if you type something in a textbox you can't use PHP to do "something". You have to sent it from a form to another PHP file :) So if you sent textbox 1 (with name="textbox1") you can retrieve it on the next page using:
$myvar = $_GET["textbox1"]
Then you can use the $myvar (which is the value of 'textbox1') to use in youre SQL or PHP code :) Hope this helps :)

Sign up to request clarification or add additional context in comments.

4 Comments

Thanks :) ok, what i want to do is create a textbox with a submit button like: '<dl> <dt><label for="name1">Username 1:</label></dt> <dd><input id="name1" type="text" size="20" maxlength="255" name="config[name1]" value="" /></dd> </dl> '
then once i put in the username it will save that username to the database under value 'name1' or something.
so when i use this line of code from the phpbb3 template file <!-- IF S_USERNAME eq "{value1}" or S_USERNAME eq "{value2}" or S_USERNAME eq "{value3}" --> i can call that value
When you press submit on the form (with a input type=text and name="name1"), it sends this data to a "input.php". This will contain something like:<code> $myvar = $_GET["name1"] (connect to database and all that stuff) $sql = "INSERT INTO table_name VALUES ('username','".$myvar."')" mysql_query($sql,$con)</code> Then its in a database and you can pull it out anytime you want :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.