473,499 Members | 1,909 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

action not working after submitting form

52 New Member
This has been confusing me for a while. I don't understand why it isn't working. In my original coding, I have an action called submitted.php and this is what is looks like:

Expand|Select|Wrap|Line Numbers
  1. <?php 
  2. $data=fopen("/home/vchan/ts2/writing.txt","r+");
  3. while(!feof($data)){
  4. $data2=fgets($data);
  5. $tmp=explode(",",$data2);
  6. $project=$tmp[0];
  7. $code=$tmp[1];
  8. $realname=$tmp[2];
  9. $counter=$tmp[3];
  10. $dateentry=$tmp[4];
  11. $name=$tmp[5];
  12. $hours=$tmp[6];
  13. $description=$tmp[7];
  14. echo '$name';
  15. }
  16. fclose($data);
  17.  
  18. ?>
  19. <html>
  20. <body>
  21. <?php
  22. echo 'Thank you for submitting. <br> To submit another, please click here.';
  23. ?>
  24. </body>
  25. </html>
  26. <?php
  27. echo '<form action="test5.php" method="post"> ';
  28. echo'<p><input type="submit" value="Submit Another"/></p>';
  29. echo '</form>';
  30. ?>
  31.  
  32.  
This isn't the full code but my problem is that it doesn't do anything after I open that first file hence it doesnt print "name". But oddly, it prints all the things in the end: "Thank you for submitting..."which is not related to the opening of the file. Any help would be greatly appreciated.><
Jun 11 '09 #1
6 4953
Dormilich
8,658 Recognized Expert Moderator Expert
@phpnewbie26
have you checked the source code? you print the name where you're not supposed to get any visible output (i.e. outside the html page, which essentially renders your document invalid).

put your php code inside the html body.

one more, you should also don't print anything after </html> (the end of the html page)

and you should use a DTD to put IE in standards mode
Jun 11 '09 #2
phpnewbie26
52 New Member
i put it inside the html body and it still doesnt work..=/ and whats a DTD?
Jun 11 '09 #3
Dormilich
8,658 Recognized Expert Moderator Expert
@phpnewbie26
post your code (and maybe the file), maybe I can see anything.

@phpnewbie26
a document type definition. see XHTML and HTML specification
Jun 11 '09 #4
phpnewbie26
52 New Member
Okay..well, it seems that I didnt save it in the right folder, but now arises the actual problem. The first line, I changed it to
Expand|Select|Wrap|Line Numbers
  1. $data=fopen("/home/$_POST["name"]/ts2/writing.txt","r+");
  2.  
My problem is that in my original coding, I type my "name" in another form which is not the same as where my action="submitted.php" is. I was wondering if there is a way to carry over variables like that. I don't know if I explained myself properly.=/
Jun 12 '09 #5
phpnewbie26
52 New Member
So I actually got it to work by using sessions. Thanks for all the help.=D
Jun 12 '09 #6
smithroy9
3 New Member
Thanks for solving my problem.
Jun 18 '09 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

1
4175
by: Michael Brennan-White | last post by:
If I submit my for using a get action the resulting page loads . If I use a post action I get an error page saying "The page cannot be found". I am calling the originating page!!! This happens...
19
2963
by: Pete | last post by:
I have form/select which executes a function using onchange. No problem. However, when I validate the page with a strict HTML 4.01 doctype at http://validator.w3.org, it demands either an action or...
4
11381
by: Tauqir | last post by:
Hi, Is there a trick for submitting an HTML form without action parameter pointing to the target file? I am trying to reverse engineer an html form inside a jsp page. and this is what I come...
2
2511
by: iam247 | last post by:
Hi In my prototype asp page (with no javascript and no password validation, I have a registration form with the following action: <form name="form" method="post" action="RegDetails.asp"> ...
2
9676
by: belgie | last post by:
Whereas in Asp I could submit my form contents to any other Asp page, it appears that in Asp.NET the primary Asp form will only submit to itself. I have tried changing the Action attribute in the...
4
2774
by: Mark Miller | last post by:
I've been trying to execute a javascript function just before submit on a form that contains an <input type="file"> input field and it isn't working. The reason I want to do this is the end users...
4
6489
by: ANTISPAM_garycnew_ANTISPAM | last post by:
I am trying to figure out the best way to change a form's action based on a single text input event. I have a search form within a larger form and would like to allow users to use the enter key...
4
7605
by: nkoier | last post by:
Hi, I've been going crazy trying to figure out what's wrong with our Asp.Net 2.0 intranet site. At the very top of our main page I provide a TextBox and a Button for submitting Google searches....
3
5386
by: shanmukhi | last post by:
hi all, i got a problem with struts. iam unable to find it. i have written an action class, form bean class and a jsp page on submitting form, request is going to action class but it is not...
0
7131
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7007
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7174
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7220
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7388
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4919
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3091
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1427
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
665
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.