LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-08-2011, 10:25 AM   #1
Dafydd
Member
 
Registered: Oct 2008
Posts: 344

Rep: Reputation: 29
Forms - no data saved or/and white screen


Using the information obtained here, the example works perfectly.
Adapting it to my needs does not.

The 'html' code shows up with a right click > view source. The PHP code does not. You can view the 'html' portion here.

Problem #1
I fill out the form, submit and the page shows back up with out displaying an error or the thank you page. No data is writen to file.


The code is nearly 200 lines so I can not post it all. If you need to see all the code, I have attached it to the bottom of this post.

Problem #2
Here are the offending PHP parts ( I think ).

If I change;
Code:
<tr>

	<td>Freshwater Topics <input type="checkbox" name="fwtopics" value="one" />1<input type="checkbox" name="fwtopics" value="two" />2<input type="checkbox" 			name="fwtopics" value="three" />3<input type="checkbox" name="fwtopics" value="four" />4</td>

</tr>
to become an 'arrays':
Code:
fwtopics[]
and point my browser toward the program on my server, I get a white screen with right click > view source showing nothing.

If I change;
Code:
$fs = fopen("meeting.survey","a+");

		fwrite($fs,$vartypefishing . "\n");

		fwrite($fs,$varwherefish . "\n");

		fwrite($fs,$varexperiencelevel . "\n");
		fwri................
to;
Code:
		fwrite($fs,$vartypefishing . ", " . "$varwherefish . ", " . "$varexperiencelevel . ", " . "$varfish . ", " . "$varflyfish . ", " . "$varoften . ", " . "$varmeetingattend . ", " . "$varattending . ", " . "$varfwtopics . ", " . "$varswtopics . ", " . "$varlocatguide . ", " . "$varexoticguide . ", " . "$varconservation . ", " . "$varbiology . ", " . "$vartactics . ", " . "$varcasting . ", " . "$vartying . ", " . "$varbuilding . ", " . "$varothertopics . ", " . "$varspeakerlike . ", " . "$varspeakertopic . ", " . "$varprogramsee . "\n ");
and point my browser toward the program on my server, I get a white screen with right click > view source showing nothing.

I'm at a loss where to go next. Suggestions please.
Attached Files
File Type: txt survey.php.txt (8.7 KB, 6 views)
 
Old 10-09-2011, 03:47 AM   #2
ButterflyMelissa
Senior Member
 
Registered: Nov 2007
Location: Somewhere on my hard drive...
Distribution: Manjaro
Posts: 2,766
Blog Entries: 23

Rep: Reputation: 411Reputation: 411Reputation: 411Reputation: 411Reputation: 411
Cool

Quote:
<td>Freshwater Topics <input type="checkbox" name="fwtopics" value="one" />1<input type="checkbox" name="fwtopics" value="two" />2<input type="checkbox" name="fwtopics" value="three" />3<input type="checkbox" name="fwtopics" value="four" />4</td>
Basic <form> syntax: you've got the same name for all three fields.
From the example

Quote:
<form action="myform.php" method="post">
Which is your favorite movie?
<input type="text" name="formMovie" maxlength="50">
<input type="submit" name="formSubmit" value="Submit">
</form>
Both fields have a different name.

Quote:
view source showing nothing.
Is to be expected...if something goes wrong, the server cannot/will not write to the PHP file. PHP is generated rarther than fetched, in case of an error (somewhere) there will be nothing genetated...

Following this thread with you

Thor

Edit

You dont really need this:

Quote:
if($_POST['formSubmit'] == "Submit")
since you call the same page, and a POST is the only way...if the condition is not met (somehow) the page dies...

IMHO you try to "cram" too much in one page. It makes things way to complex for you. I (humbly) suggest:
- an entry page with the <form> and with a commit page as action
- the commit page it self, in case of an error, pointing to the error page, in case of success, it could move to an other part of the site
- an error page, with a link to the entry page

Edit2
I noticed you try to write to a (flat) file, do you have write-permissions where you try to do that? If not, the script will fail...

Edit3:

Check the attachments, I've posted two frames for you to work with...enjoy
Attached Files
File Type: txt commit.php.txt (533 Bytes, 7 views)
File Type: txt survey1.php.txt (243 Bytes, 4 views)

Last edited by ButterflyMelissa; 10-09-2011 at 04:15 AM. Reason: Added attachments
 
Old 10-09-2011, 03:23 PM   #3
Dafydd
Member
 
Registered: Oct 2008
Posts: 344

Original Poster
Rep: Reputation: 29
Thanks for the feed back. Let me dig into it. Will be back middle of week.

Right now,it is raining at my house. First time in 10 months. I have puddles of water standing in my front yard and I'm going to go outside and STOMP and SPLASH and SQUEEEE like the little boy I have suddenly become.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
i want to format hda hd but will all data be saved in other harddisk mohdsuboor23 Fedora 4 10-25-2010 07:31 AM
How to make data persist through webpages via Forms resetreset Programming 4 08-18-2010 12:55 PM
Problem: Youtube video screen - Shockwave flash - White screen. Firefox. NOoBuntuLinux Ubuntu 5 04-29-2010 08:44 PM
White screen then hashed screen on fresh install slan124 Fedora 4 04-14-2006 03:54 AM
HTML, PHP, forms, submitting data Problem Silent1 Programming 3 08-31-2004 03:03 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:15 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration