Jump to content

Need help with a form


Gyohdon

Recommended Posts

Hello everybody. Let me just start with two things:First, your tutorials are amazing.Second, I'm completely new to this world of coding and programming. I know a little html and php nd a bit of javascript, but nothing too beautiful. So go easy on me :)Okay, now here's my situation:I put a form in a table datacell and gave it various text fields and a textarea and on the redirecting page i wanted to show the text that was filled in the text fields/area.However it doesn't work. It just shows blank.I'll just give you the code, makes it much easier of course.Form page:

				<form action="Submit.php" method="post">					<br /><b>Post your thought!:</b><br />						<textarea name="idea" rows="10" cols="70"></textarea><br /><br />																	<b>Name:	</b>											<input type="text" size="15" name="realname" /> <b>Show?: </b>									<input type="radio" name="showname" value="yes" /><b> Yes</b>					<input type="radio" name="showname" value="no" /><b> No</b>				<br />								<b>Email*:	</b>									<input type="text" size="25" name="email" />				<br />												<b>Category:	</b>						<select name="categories">							<option value="politics">Politics</option>							<option value="economics">Economics</option>							<option value="education">Education</option>							<option value="science">Science</option>						</select>					<input type="submit" value="Post!" />				</form>

Redirecting page:

Name: <?php echo $_REQUEST["realname"]; ?><br />Email: <?php echo $_REQUEST["email"]; ?><br />Category: <?php echo $_REQUEST["categories"]; ?><br /><br />Idea:<br /><?php echo $_REQUEST["idea"]; ?>

I used these parts of the PHP tutorial to write this code:http://www.w3schools.com/php/php_forms.asphttp://www.w3schools.com/php/php_get.asphttp://www.w3schools.com/php/php_post.aspAny suggestions, idea's, tips?

Link to comment
Share on other sites

Hello everybody. Let me just start with two things:First, your tutorials are amazing.Second, I'm completely new to this world of coding and programming. I know a little html and php nd a bit of javascript, but nothing too beautiful. So go easy on me :)Okay, now here's my situation:I put a form in a table datacell and gave it various text fields and a textarea and on the redirecting page i wanted to show the text that was filled in the text fields/area.However it doesn't work. It just shows blank.I'll just give you the code, makes it much easier of course.Form page:
				<form action="Submit.php" method="post">					<br /><b>Post your thought!:</b><br />						<textarea name="idea" rows="10" cols="70"></textarea><br /><br />																	<b>Name:	</b>											<input type="text" size="15" name="realname" /> <b>Show?: </b>									<input type="radio" name="showname" value="yes" /><b> Yes</b>					<input type="radio" name="showname" value="no" /><b> No</b>				<br />								<b>Email*:	</b>									<input type="text" size="25" name="email" />				<br />												<b>Category:	</b>						<select name="categories">							<option value="politics">Politics</option>							<option value="economics">Economics</option>							<option value="education">Education</option>							<option value="science">Science</option>						</select>					<input type="submit" value="Post!" />				</form>

Redirecting page:

Name: <?php echo $_REQUEST["realname"]; ?><br />Email: <?php echo $_REQUEST["email"]; ?><br />Category: <?php echo $_REQUEST["categories"]; ?><br /><br />Idea:<br /><?php echo $_REQUEST["idea"]; ?>

I used these parts of the PHP tutorial to write this code:http://www.w3schools.com/php/php_forms.asphttp://www.w3schools.com/php/php_get.asphttp://www.w3schools.com/php/php_post.aspAny suggestions, idea's, tips?

Okay, I'll take a shot and figuring this out. To me your code looks fine, but I suppose it could be dependent on your settings etc etc. First thing, is your redirecting page actually redirecting you to the actual Submit.php (Or was it submit.php instead of a capital 'S'). $_REQUEST could not be activated within your php.ini file.. could be but I am not sure, last I checked it was activated by default but you could check it out to make sure. Just to exclude the fact it is based on the $_REQUEST variable, you could try using $_POST['var_name']; instead and see if that helps any. If not, I am stumped myself I would have thought that would work.Also could be your version of PHP?Update: I've tried the code myself and it seems to work for me perfectly fine. So I would narrow it down to your PHP version, or ini file. Just my thought. See if you have global variables activated that could be the cause. Since I think $_REQUEST is a global variable.
Link to comment
Share on other sites

Okay, I'll take a shot and figuring this out. To me your code looks fine, but I suppose it could be dependent on your settings etc etc. First thing, is your redirecting page actually redirecting you to the actual Submit.php (Or was it submit.php instead of a capital 'S'). $_REQUEST could not be activated within your php.ini file.. could be but I am not sure, last I checked it was activated by default but you could check it out to make sure. Just to exclude the fact it is based on the $_REQUEST variable, you could try using $_POST['var_name']; instead and see if that helps any. If not, I am stumped myself I would have thought that would work.Also could be your version of PHP?Update: I've tried the code myself and it seems to work for me perfectly fine. So I would narrow it down to your PHP version, or ini file. Just my thought. See if you have global variables activated that could be the cause. Since I think $_REQUEST is a global variable.
I actually used POST first, but then it didn't work so I changed to REQUEST. Also, I downloaded my phpserver a week ago, so I doubt that's the problem.However, what's an .ini file?
Link to comment
Share on other sites

I actually used POST first, but then it didn't work so I changed to REQUEST. Also, I downloaded my phpserver a week ago, so I doubt that's the problem.However, what's an .ini file?
php.ini file is a setting file for php. you have to configure your php.ini file as your need. to parse php file you need to configure your server and your php.ini file also. it seems to me there is some problem with your settings so your code is not parsing.1) make sure your istallation is ok2) check that your form processing file name is same as in your <form action="yourfile" method="post">may be some more expert can tell the right solution more correctly.
Link to comment
Share on other sites

I just checked my server, it says it has PHP version 5.3.0. It also included a php.ini textfile.Does that mean my installation is okay?
i am not sure which file you are talkin about. if you are talkin about php.ini file in your hard drive...? only that does not mean that it is working
<?phpphpinfo();?>

you will see your php config details. if your installation is ok. you will be able to see the page.

Link to comment
Share on other sites

Where should I run that code?In a regular .php file somewhere in the body between <html> tags, or simply a .php file with just that?
write your code in notepad with .php extension and put it in your web root folder. then type the url of the page in your browser (eg. localhost)just only this code is enough.w3school has a guide for instllation and other things related to php you may check that also.
Link to comment
Share on other sites

write your code in notepad with .php extension and put it in your web root folder. then type the url of the page in your browser (eg. localhost)as far i can remember w3school has a guide for instllation. you may check that also.
Okay, I did it on desktop and nothing happened.I'm pretty new to the technological terms, what's the web root folder?Is that the file dubbed 'www directory'?EDIT: It works, got my version page. What exactly should I check now?
Link to comment
Share on other sites

Okay, I did it on desktop and nothing happened.I'm pretty new to the technological terms, what's the web root folder?Is that the file dubbed 'www directory'?EDIT: It works, got my version page. What exactly should I check now?
if you are in local computer (your own pc) then its depend on your server you installed. in apache its htdocs and i am not sure about IIS root folder cause i use apache. i think in IIS its www as far i can remember ...i am not sure.and if you are in any online host its probably will goes in public_html folderyou cant execute php file directly. you have to call it from browser and ofcourse it should be in the web root directory
Link to comment
Share on other sites

then your installation seems ok. you can see all of info about your php. you can now put your code in webroot directory. and call them as . eg: localhost/index.phpi think it should work now

Link to comment
Share on other sites

then your installation seems ok. you can see all of info about your php. you can now put your code in webroot directory. and call them as . eg: localhost/index.phpi think it should work now
<3Thanks
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...