New Learner Needs Help!!!!

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
Chocolate_Raindrop
Forum Newbie
Posts: 11
Joined: Thu May 20, 2004 6:07 pm
Location: Alabama
Contact:

New Learner Needs Help!!!!

Post 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.
mikebr
Forum Contributor
Posts: 243
Joined: Sat Sep 28, 2002 7:05 am

Post by mikebr »

Can you be a bit clearer in what you are asking?
User avatar
tim
DevNet Resident
Posts: 1165
Joined: Thu Feb 12, 2004 7:19 pm
Location: ohio

Post 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
User avatar
dull1554
Forum Regular
Posts: 680
Joined: Sat Nov 22, 2003 11:26 am
Location: 42:21:35.359N, 76:02:20.688W

Post 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.....
User avatar
tim
DevNet Resident
Posts: 1165
Joined: Thu Feb 12, 2004 7:19 pm
Location: ohio

Post 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
User avatar
Joe
Forum Regular
Posts: 939
Joined: Sun Feb 29, 2004 1:26 pm
Location: UK - Glasgow

Post 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.
User avatar
dull1554
Forum Regular
Posts: 680
Joined: Sat Nov 22, 2003 11:26 am
Location: 42:21:35.359N, 76:02:20.688W

Post by dull1554 »

i think sessions would be the best way also
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

code

Post by josh »

Something along these lines for a multi page form..

(note: not error checked or tested)

Code: Select all

<?php
$page=$_REQUEST&#1111;'page'];
if ($page==NULL)&#123;
	//	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");
&#125;

if ($page==2) &#123;
	// Assumeing these are your fields that came from your form:
	$name=$_REQUEST&#1111;'name'];
	$email=$_REQUEST&#1111;'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");
&#125;

?>
User avatar
buddok
Forum Commoner
Posts: 50
Joined: Tue May 25, 2004 2:44 pm

stupid ikkle me

Post 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 ? :oops:
Chocolate_Raindrop
Forum Newbie
Posts: 11
Joined: Thu May 20, 2004 6:07 pm
Location: Alabama
Contact:

Help!!!

Post 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);
?>
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

it means you can't write to files through http without help from the "other side"
Chocolate_Raindrop
Forum Newbie
Posts: 11
Joined: Thu May 20, 2004 6:07 pm
Location: Alabama
Contact:

Post by Chocolate_Raindrop »

but how can i fix it?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

hmm... using ftp, or telnet, or using a script on that side to make changes...
Chocolate_Raindrop
Forum Newbie
Posts: 11
Joined: Thu May 20, 2004 6:07 pm
Location: Alabama
Contact:

Post by Chocolate_Raindrop »

i'm really too new at this that i don't know. i guess i'm using ftp.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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.
Post Reply