Jump to content


Best way to make a form sort of thing?


5 replies to this topic

#1 Artifice

    Young Padawan

  • Members
  • Pip
  • 14 posts

Posted 19 May 2005 - 10:52 AM

Alright, so here's the background: I'm designing a website for a teacher. All of the layout is completed, and much of the content is up. The one thing that he wants now is a way to put up what the homework is each day.

Now, what I want to do is have a password-protected page (I can do that just fine) where he can go and fill in fields that will update the homework on the homework page.

How would I go about making those fields and have it show up on another page? Like, where would be a good place to start working with that?

Have a nice day everyone. :lol:

#2 fiv3isaliv3

    Young Padawan

  • Members
  • Pip
  • 258 posts
  • Gender:Male

Posted 19 May 2005 - 02:59 PM

http://www.htmldog.c...beginner/forms/

more clarification as to what you mean exactly would be helpful... but the above page should get you started with forms and the like.

#3 Artifice

    Young Padawan

  • Members
  • Pip
  • 14 posts

Posted 20 May 2005 - 05:50 AM

Thanks. :hi:

A little more clarification...hmm: I think that what I'm trying to do is have a form store some information in a mySQL table,and then have another page use that information for its content, pretty much like a forum but much more basic.

That more helpful?

Have a nice day everyone. ;)

#4 fiv3isaliv3

    Young Padawan

  • Members
  • Pip
  • 258 posts
  • Gender:Male

Posted 20 May 2005 - 03:56 PM

to store the information you'd first post the information to a page. next you'd do a query to insert the information posted into a table. to display it you'd do a query to get the information and then you would just echo it. if you want some example code of what each step would look like i can provide that.

#5 Artifice

    Young Padawan

  • Members
  • Pip
  • 14 posts

Posted 20 May 2005 - 10:09 PM

If you could provide that, that would be absolutely awesome. ;)

Have a nice day everyone. :P

#6 fiv3isaliv3

    Young Padawan

  • Members
  • Pip
  • 258 posts
  • Gender:Male

Posted 21 May 2005 - 10:32 PM

$_POST["name"]

this is how the information is sent when you post it. post name is basically whatever the name is of the input form. if there was a text box called password then you'd simply do.

$_POST["password"]

this is an example of inserting information that was posted from the form to the page of your choosing.

$insert_query = mysql_query("INSERT INTO users (user,ip,time,id) VALUES ('".$_POST["user"]."','$ip','$time','NULL')") or die('Error @ 1 '.mysql_error());


lastly this would be an example of selecting information from the table after it is inserted.

$user_query = mysql_query("SELECT * FROM users") or die('Error @ 2 '.mysql_error());
while ($list = mysql_fetch_object($user_query)){
echo "$list->user";
}


hope that helps.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users