Page 1 of 1
New Learner Needs Help!!!!
Posted: Mon May 24, 2004 11:32 am
by Chocolate_Raindrop
I'm very new at PHP...actually I'm a CS major and PHP is not taught at my school. I was wondering if anyone can help me. I have created an HTML form and I know how to get my information to post through PHP but how can I get the entries to lock in place and add more entries to the bottom of the page. I have looked at every PHP tutorial but they don't answer my questions.
Posted: Mon May 24, 2004 4:47 pm
by mikebr
Can you be a bit clearer in what you are asking?
Posted: Mon May 24, 2004 5:45 pm
by tim
thru sessions you can define many variables.
perhaps that is what you need, but I dont understand /to lock in place and get more entires at the bottom/
as said, please be more clear
Posted: Mon May 24, 2004 5:56 pm
by dull1554
he might mean that .... say he starts out with 4 text fields but he needs more then 4 to gather the requiered info, but he don't wanna clutter up the page with a whole slue of text fields. so he might want to have the user fill out a few, then submit them, then fillout some more that were added to the page....and so on and so on...
maybe just maybe... thats what he ment.....
Posted: Mon May 24, 2004 5:58 pm
by tim
well maybe, just maybe
i'll suggest sessions again =]
or hidden text fields, but sessions I think would be the way to go
Posted: Mon May 24, 2004 6:05 pm
by Joe
you can get information to post from a form by using $_POST['variable'] and to make it stay there, well thats a different situation all together. You would have to be more specific on what your asking.
Posted: Mon May 24, 2004 6:46 pm
by dull1554
i think sessions would be the best way also
code
Posted: Mon May 24, 2004 7:09 pm
by josh
Something along these lines for a multi page form..
(note: not error checked or tested)
Code: Select all
<?php
$page=$_REQUESTї'page'];
if ($page==NULL){
// Display the form, submit form to form?page=2
$form=("
<form name="form1" method="post" action="form.php">
Name:
<input type="text" name="textfield">
Email:
<input type="text" name="textfield2">
<input name="page" type="hidden" id="page" value="2">
<input type="submit" name="Submit" value="Submit">
</form>
");
echo("$form");
}
if ($page==2) {
// Assumeing these are your fields that came from your form:
$name=$_REQUESTї'name'];
$email=$_REQUESTї'email'];
$form=("
<form name="form1" method="post" action="form.php" value="$name">
Name:
<input type="text" name="textfield" value="$email">
Email:
<input type="text" name="textfield2">
<input name="page" type="hidden" id="page" value="3">
<input type="submit" name="Submit" value="Submit">
</form>
");
echo("$form");
}
?>
stupid ikkle me
Posted: Tue May 25, 2004 2:44 pm
by buddok
ok well me an my mate have a site an ive made a login so jus me an him can get on to the page with the form, then i need to be able to type in the form and put it onto another page in a list but set out well :S any one got any ideas ?

Help!!!
Posted: Thu May 27, 2004 1:45 pm
by Chocolate_Raindrop
Warning: fopen(
http://www.icdat.cc/cdrop/gb.txt): failed to open stream: HTTP wrapper does not support writeable connections. in /home/icdatcc/public_html/cdrop/gb.php on line 7
that's the message I get. what does it mean? here are the codes that I have.
<form action="
http://www.icdat.cc/cdrop/gb.php" method="post">
Name: <input type="text" name="name" value=""><br>
Location: <input type="text" name="location" value=""><br>
Email: <input type="text" name="email" value=""><br>
Message:<br><textarea name="message" rows="10" cols="40"></textarea><br>
<input type="submit" name="submit" value="submit">
</form>
Code: Select all
<?php
$somecontent = "This is a test\n";
$file = fopen("http://www.icdat.cc/cdrop/gb.txt", "a+");
if (!$file) {
echo "<p>Unable to create file for writing.\n";
exit;
}
fputs ($file, $somecontent);
fclose($file);
?>
Posted: Thu May 27, 2004 1:48 pm
by feyd
it means you can't write to files through http without help from the "other side"
Posted: Thu May 27, 2004 1:48 pm
by Chocolate_Raindrop
but how can i fix it?
Posted: Thu May 27, 2004 1:50 pm
by feyd
hmm... using ftp, or telnet, or using a script on that side to make changes...
Posted: Thu May 27, 2004 1:51 pm
by Chocolate_Raindrop
i'm really too new at this that i don't know. i guess i'm using ftp.
Posted: Thu May 27, 2004 2:02 pm
by feyd
it actually looks like you are on the same server as the file, in fact, the same folder too... try changing the fopen() from an http reference to just the filename.