473,624 Members | 2,426 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..."w hich is not related to the opening of the file. Any help would be greatly appreciated.><
Jun 11 '09 #1
6 4969
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="submitt ed.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
4188
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 in IE as well as FireFox. This code has been tested on a Win2003 server, IIS6, PHP 5.0.3, mySQL 4.1.8 and it works fine. The problem server is a Win2k server, IIS5, PHP 5.0.4, mySQL 4.1.11.
19
2978
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 a method for the form?. If I give it an empty action <form action="" ..... it validates OK. Is this acceptable or is there a better/standards correct way? Thanks.
4
11408
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 across <form method="POST" name="Userpasshidden" onsubmit='return true'><!-- action="../../login.jsp" --> .....
2
2539
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"> This works fine, the form details are collected by RegDetails.asp I am attempting to include javascript server side validation for the
2
9685
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 Form tag, but it changes itself back when compiled. I have also tried changing the form Action attribute in client-side javascript prior to submitting the form, but I get this error: The View State is invalid for this page and might be...
4
2785
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 will be uploading files that are between 1 and 2 Meg. in size, and they are not too knowledgeable about computers. I want to disable the form buttons so they can't hit them after they hit the "upload" button. We're trying to prevent them from...
4
6502
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 within the search text input without submitting the larger form. I discovered the onKeyPress event and the keyCode for the Enter Key (13). Now I need to figure out a way to pass the result of the onKeyPress to the larger form's onSubmit event to...
4
7618
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. Recently somebody pointed out to me that you can't just press ENTER anymore after typing in the TextBox but that you HAVE to click on the submit Button WITH THE MOUSE for it to work. After some initial troubleshooting I discovered that it's only...
3
5393
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 executing action class iam unable to solve it... here is my code FormLogin.java public class FormLogin extends ActionForm{ private String username=null;;
0
8240
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8680
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8625
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8336
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6111
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5565
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4082
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2610
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 we have to send another system
2
1487
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.