How Do You Make Text Boxes?


#1

Hello, I was wondering if anyone could help. I don’t know how to create a text box on my website so that people can put words and numbers into the text box, press enter, and then my website could store the information in a database somewhere. Please help me. -Steven


#2

Are you coding or are you using a website builder?


#3

Using a website builder.


#4

wich website builder


#5

I don’t use a website builder. Maybe lobrc could help.


#6

Steven what kind of website are you looking for?
A form that emails you with their information?
A login/database system?
Or just a text box to store into a database system?
If you want post your website address.


#7

I’m just thinking of a website that’s just plain text, but there is a text box embedded in the middle of the page so people can enter their name, and I will have a hidden database somewhere storing all the names. For example:

This is the techie’s lair. Please enter your name.
TEXT BOX and then enter button

If you do not want to say your name, that is okay.

I am currently making my website on a free account with 000webhost, and the reason I am asking is because I don’t know how to do this with the website builder. Thank you for any responses.


#8


If they submit it does it matter if it is stored into a text file like so

http://yoursite.com/names.txt

Name: Dave

Name: James

Name: Bob

etc or do you want it in a database such as phpmyadmin/mysql


#9

Yeah, it can be stored in a text file like the one at http://yoursite.com/names.txt. How do I write this text box and store the info entered in a database, though? Thanks.


#10

Thank you for any help.


#11

If you have any HTML code for what I want to do, please also add it.


#12

Oh sorry I went out for supper.

Anyhow yeah this code should be something your looking for.
Create these files and call them the names above it

Create table in a new mysql database


CREATE TABLE `table_user` (
  `user_id` int(2) NOT NULL auto_increment,
  `user_fname` varchar(10) NOT NULL,
  `user_lname` varchar(10) NOT NULL,
 
  PRIMARY KEY  (`user_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1123 ;

php file to write data


$con = mysql_connect("localhost","root","");
	if (!$con)
	  {
	  die('Could not connect: ' . mysql_error());
	  }
	  else
	  {
	 // echo('Connected with Mysql');
	  }
 
@mysql_select_db("db_name", $con);// connect to database db_name
 
 
	if (isset($_POST['Submit']))
	{
$sql="INSERT INTO table_user (user_fname, user_lname)	VALUES('$_POST[user_fname]','$_POST[user_lname]')";
		@mysql_query($sql,$con);

form structure


<table>
 <td width="141" align="left" valign="top" >First Name</td>
                          <td width="163" align="left" valign="top"><input name="user_fname" type="text" id="user_fname"></td>
<td align="left" valign="top" >Last Name</td>
                          <td colspan="4" align="left" valign="top"><input name="user_lname" type="text" id="user_lname">
 
<input name="Submit" type="submit" value="Submit" >
</table>

#13

Just a short comment: avoid using .txt files at 000webhost, there were more problems with this extension in the past (its usage is not allowed). Use .dat extension (of course, with the same content), and it will be o.k.
Anyway, the best method would be a database storage mechanism (it is more dynamic, there are no file permission problems etc.).


#14

Dear,

As I understand this question,
you want to learn how to program this.

Let’s go to school then for this one.

Why not check this out?
https://www.bitdegree.org/learn/mysql-insert-into

Many more lessons can be found on that site.

I learned alot there.