Closed Thread Icon

Topic awaiting preservation: Form help (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=12775" title="Pages that link to Topic awaiting preservation: Form help (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: Form help <span class="small">(Page 1 of 1)</span>\

 
darknosis
Bipolar (III) Inmate

From: Lahore, Pakistan
Insane since: Mar 2003

posted posted 06-07-2003 08:13

can anyone tell me how to make a form for posting questions, not a forum/messageboard whatever just a FORM. anyone and does anyone know how a script for those auto scroller thingys, you know mouse over and it scrolls down/up??

Lurch
Paranoid (IV) Inmate

From: Behind the Wheel
Insane since: Jan 2002

posted posted 06-07-2003 10:08

ok the form... what do you want it to do? "just a form" would be an html form.. what is it that you want it to do? post to the page? email someone?

the scroller question would not be a server side q, but one for the dhtml, js forum i believe


darknosis
Bipolar (III) Inmate

From: Lahore, Pakistan
Insane since: Mar 2003

posted posted 06-07-2003 11:13

that's right Lurch and simple HTML Form name, email, question etc etc and the question is displayed on a page i can view later.

CPrompt
Maniac (V) Inmate

From: there...no..there.....
Insane since: May 2001

posted posted 06-07-2003 16:02

Here is some code that I am working on. You can adjust it to your needs. Make a folder that will contain all your posts. I called mine "posts"
Put this code at the very top of the page (before the <doctype> ):

code:
<?

//set the identifier of each post
$identifier = time();

//get the time and format it to be included in the post
$myTime = date("F j, Y, g:i a");

//if the datestamp works then do this . . .
if ($datestamp){
//after the post is made, go back to index page
header ("Location: ../index.php"); //<--this may need to be changed to fit your page you want them to go back to after posting

//save the post as a *.dat file
//point this to the folder
$filePointer = fopen("../posts/{$identifier}posts.dat", "a+");

//strip off the slashes so that It's doesn't come out like It\'s
$header=stripslashes($header);
$comment=stripslashes($comment);

//formating each posting. . .
fwrite($filePointer,"
<p class=\"date\">$myTime\r\n</p><br />
<div class=\"email\">$email\r\n</div>
<p class=\"commentText\">$comment\r\n</p><br />
<hr />");

//close it up
fclose($filePointer);
}

?>



Then on the same page, in the body of the page, make a form:

code:
<form method="POST" action=" <? print "$PHP_SELF" ?>" name="outputForm">

<p />time:<input type="text" name="myTime" value="<? echo "$myTime" ?>"><br />
<p />header:<input type="text" name="email" value=""><br />
<p />body:<textarea name="comment" rows="15" cols="50"></textarea><br />
<input type="SUBMIT" name="submit" value="submit" class="submit"><br />
<input type="hidden" name="datestamp" value="<? print "$identifier"; ?>" > //<--This is just to pass the file name to be saved
</form>



That should take care of the posting, now to view it. Whatever page you want to view the postings in, put this code in the body of that page:

code:
<?

//open the posts folder
$dir_name = "../posts/"; //<--Must point to the folder that contains the postings
$dir = opendir($dir_name);

//plop them into an array
$file_list = array();

//loop through the directory
while ($file_name = readdir($dir)) {
if (preg_match("/dat\$/i", $file_name)) {
array_push($file_list, $dir_name.$file_name);
}
}

//reverse the order of the array so that
//the latest post is on top
rsort($file_list);

//do another loop to include every file
//on this section we are also going to give links
//for editing and deleting of posts.
foreach ($file_list as $var){
include($var);
}



That should do it. Hope you have PHP

Later,

C:\


~Binary is best~

darknosis
Bipolar (III) Inmate

From: Lahore, Pakistan
Insane since: Mar 2003

posted posted 06-07-2003 18:10

say thanx CPrompt that worked alrite

CPrompt
Maniac (V) Inmate

From: there...no..there.....
Insane since: May 2001

posted posted 06-08-2003 00:36

no problem. glad it worked. I have yet to discover how to get those posts backinto a form for editing. I'm giving up for a couple of days and let my brain heal

Later,

C:\


~Binary is best~

butcher
Paranoid (IV) Inmate

From: New Jersey, USA
Insane since: Oct 2000

posted posted 06-08-2003 01:49

CPrompt

I'm not sure if this is what you mean, but if you want to put the values from a database into a form for editing you can draw the values out with your MySQL query and then while through them:

code:
while ($row = mysql_fetch_array($result)) {
$value_1 = $row['value_1'];
$value_2 = $row['value_2'];
$value_3 = $row['value_3'];
}

<form>
<input type="text" name="value_1" value="$value_1">
<input type="text" name="value_2" value="$value_2">
<input type="text" name="value_3" value="$value_3">
</form>



Hope this helps and sorry if I missed the point.

-Butcher-

CPrompt
Maniac (V) Inmate

From: there...no..there.....
Insane since: May 2001

posted posted 06-08-2003 05:59

butcher, thanks for the input. However, I am using flat text files to save the data
I don't have a copy of it on a site to look at, but if you want to check out what the code looks like and the pages, I can put them as text files for you. There are a few pages (4).

I can start a new thread actually. However, I have asked this question in a thread and I can't seem to get it right.

Here is the thread that I was discussing it in. Pop in and see if you can help me out

Later,

C:\


~Binary is best~

[This message has been edited by CPrompt (edited 06-08-2003).]

darknosis
Bipolar (III) Inmate

From: Lahore, Pakistan
Insane since: Mar 2003

posted posted 06-08-2003 09:23

I'm sorry to say this CPrompt but yo script don't work... now I made mine in Java and another problem I made a post in the DHTML/Javascript Section...

« BackwardsOnwards »

Show Forum Drop Down Menu