Searching: How to asking user input data into TEXT BOX
Posted: Mon Dec 02, 2002 10:42 am
Hi There!
I have a problem in order to making / writting SQL. The problem is I want to ask user input any 'data' such as name or other related into TEXT BOX. After data have been inputed, SUBMIT BUTTON will perform a query regarding 'data' and produce a result in table.
What should I put in ? name=?. The above code is for instance
filename: form.html; to provide a FORM
And this is code for databaseSQL.php; to process QUERY
PLEASE HELP ME!. yOU CAN visit this site for information and look at SUBMIT BUTTON ; http://www.kopkastam.org.my/ahli
I have a problem in order to making / writting SQL. The problem is I want to ask user input any 'data' such as name or other related into TEXT BOX. After data have been inputed, SUBMIT BUTTON will perform a query regarding 'data' and produce a result in table.
What should I put in ? name=?. The above code is for instance
filename: form.html; to provide a FORM
Code: Select all
html>
<body>
<form action="databaseSQL.php" method="post">
<TEXTAREA cols=20 name=sql rows=5>
<?PHP
echo(stripslashes($_POSTї"sql"]));
?></TEXTAREA>
<input type="submit" name="sql_post">
</form>
</BODY>
</html>Code: Select all
<HTML>
<HEAD>
<TITLE>Listing 17.3</TITLE>
</HEAD>
<BODY>
<?
//connect to server, then test for failure
if(!($dbLink = mysql_pconnect("localhost", "user ","password")))
{
print("Failed to connect to database!<BR>\n");
print("Aborting!<BR>\n");
exit();
}
//select database, then test for failure
if(!mysql_select_db("maildb", $dbLink))
{
print("Can't use the test database!<BR>\n");
print("Aborting!<BR>\n");
exit();
}
// get everything from catalog table
$Query = "SELECT '$sql'";
$Query .= "FROM addressbook";
if(!($dbResult = mysql_query($Query, $dbLink)))
{
print("Couldn't execute query!<BR>\n");
print("MySQL reports:tak jumpa "); //. mysql_error() . "<BR>\n");
print("Query was: $Query<BR>\n");
exit();
}
//start table
print("<TABLE BORDER="1">\n");
//create header row
print("<TR>\n");
// print("<TD BGCOLOR="#CCCCCC"><B>id</B></TD>\n");
print("<TD BGCOLOR="#CCCCCD"><B>name</B></TD>\n");
print("<TD BGCOLOR="#CCCCCC"><B>email</B></TD>\n");
print("</TR>\n");
// get each row
while($dbRow = mysql_fetch_object($dbResult))
{
print("<TR>\n");
// print("<TD>$dbrow->id</TD>\n");
print("<TD ALIGN="right">$dbRow->name</TD>\n");
print("<TD ALIGN="left">$dbRow->email</TD>\n");
print("</TR>\n");
}
//end table
print("</TABLE>\n");
?>
</BODY>
</HTML>