text input form code

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
lincolnHawk
Forum Newbie
Posts: 2
Joined: Wed May 27, 2009 11:41 pm

text input form code

Post by lincolnHawk »

Hey guys,
Im looking to put a text input form in my site with multiple forms to save data on my hosts server. the form I am looking for would have ten spots for saving data. each time a new field would be updated with data. It will not erase the previous fields already stored in the form. I already have a search option on my siteI would like to add capability to the search button. i would like to have it that people can save the usernames of individuals that they are interested in there for sale post. "I have a classifieds site" During the week the person whose username was saved. Searches his own username. and voila up comes the list of posts of people that liked his item. now you can see there product and maybe arrange some type of swap. mY search button already searches pictures of posts in categories. How could I add this option to to search my save form to my current search button. Any info anybody has just on the form or on how to alter a save button to do something like this would be AmAzInG. sorry if i put people to sleep just trying describe it best as possible Thankss
ibizaweb2
Forum Newbie
Posts: 4
Joined: Fri May 29, 2009 1:32 pm

Re: text input form code

Post by ibizaweb2 »

Too many things at once. I still dont know what exactly you need.
lincolnHawk
Forum Newbie
Posts: 2
Joined: Wed May 27, 2009 11:41 pm

Re: text input form code

Post by lincolnHawk »

hey guys i think i finally found a form that i like i am trying to upload it to phpmy admin. I downloaded the file first on my ftp client. Then on php my admin i attempt to import it. here is the exact code that Im using. i keep getting syntax errors and punctuation strings. Im trying to get this to work. Im a complete newb. any info on what im doing wrong. Is greatly appreciated.


<?php
/* constant declarations */
// Left out the user, password, and database name
define('MYSQL_HOST', 'localhost');
define('MYSQL_USER', '');
define('MYSQL_PASS', '');
define('MYSQL_DB', '');
/* Main Program */
if(! isset($action) )
{
$action = NULL;
}
switch ($action)
{
default:
displayform();
break;
case 'username':
username($HTTP_POST_VARS);
displaysuccess();
break;
}
/*definitions are below this point */
function displayform()
{
head();
?>
<form action = "<?php echo $PHP_SELF ?>" method = "post">
<input type = "hidden" name = "action" value = "username">

username: </b><input type = "text" name = "user"><br> <p>
username: </b><input type = "text" name = "user"><br> <p>
username: </b><input type = "text" name = "user"><br> <p>
username: </b><input type = "text" name = "user"><br> <p>
username: </b><input type = "text" name = "user"><br> <p>
username: </b><input type = "text" name = "user"><br> <p>
username: </b><input type = "text" name = "user"><br> <p>
username: </b><input type = "text" name = "user"><br> <p>
username: </b><input type = "text" name = "user"><br> <p>
username: </b><input type = "text" name = "user"><br> <p>


<input type = "submit">
</form>
<?php
foot();
}
function username ($input)
{
// If we fail to conect, we can't keep going, so we exit
if(! mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_PASS) )
{
echo ' Failed to connect to host " ' . MYSQL_HOST . ' ".';
exit;
}
mysql_select_db(MYSQL_DB);
mysql_$query("INSERT INTO --------- SET username = '{$input ['username']}', username = '{$input ['username']}', username = '{$input ['username']}', username = '{$input ['username']}', username = '{$input ['username']}', username = '{$input ['username']}', username = '{$input ['username']}', username = '{$input ['username']}', username = '{$input ['username']}', username = '{$input ['username']} ");
}
function displaysuccess()
{
head();
?>
Your submission has been completed!
<?php
foot();
}
function head()
{
echo "<html> <body>";
}
function foot()
{
echo "</html> </body>";
}
?>
Post Reply