Jump to content

Javascript to Add a Text Input field

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
6 replies to this topic

#1
lincolnHawk

lincolnHawk

    Newbie

  • Members
  • Pip
  • 4 posts
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

#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
You want the <form> tag with 10 <input> tags. You will need a server-side language to store the results.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
lincolnHawk

lincolnHawk

    Newbie

  • Members
  • Pip
  • 4 posts
server side language like php? my script is in php could i just copy code into the present script would that work? Thanks

#4
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
PHP works. You will need PHP to handle the submitted form and probably save the data in a database (MySQL comes to mind).
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#5
lincolnHawk

lincolnHawk

    Newbie

  • Members
  • Pip
  • 4 posts
any buddy want to add the code to my site script ill pay for it. Also would be awesome if they can explain what they did. Seeing that I am also trying to learn a little. Im amazed that I was able to install the site on my server. Now the code work to modify it is giving my brain a meltdown. thanks

#6
hkp

hkp

    Learning Programmer

  • Members
  • PipPipPip
  • 37 posts
you have to use server side language like asp and php

_______________
Design a website

#7
lincolnHawk

lincolnHawk

    Newbie

  • Members
  • Pip
  • 4 posts
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>";
}
?>

Edited by WingedPanther, 30 May 2009 - 05:17 PM.
add code tags (the php button)