473,480 Members | 1,944 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Trying to set form action to same page, but getting a 'not found' error.

26 New Member
Hi guys! Thanks a lot for helping me yesterday. But now I have a new problem. I have a module in joomla which I write PHP code in.
[PHP]$thisfile ="http://192.168.1.38/demotest/index.php?option=com_content&task=view&" . "id=" . "$id" . "&Itemid=" . "$itemid";[/PHP]

$id and $itemid are variables that tells me what to call on (the page I am on). the address I get when I print out is "http://192.168.1.38/demotest/index.php?option=com_content&task=view&id=12&Itemi d=26"
which is the current address I am on.


$thisfile is supposed to work in my form like this:
[PHP]<form id="form1" name="frmname" method="post" action="<? echo $_SERVER['$thisfile']?>">[/PHP]

But when I fill something in my form, and press submit, I get the following error: "The requested URL was not found on this server. The link on the ">referring page seems to be wrong or outdated. Please inform the author of ">that page about the error. If you entered the URL manually please check your spelling and try again."

I have tried to change the code, change the $thisfile, but I can't seem to fix it. It worked before :-(

What I want to do is call on itself, so I can fill out the form, submit it, and reload it.

Can anyone see anything wrong?


Phopman
Aug 29 '07 #1
6 1807
pbmods
5,821 Recognized Expert Expert
Changed thread title to better describe the problem (did you know that threads whose titles that do not follow the Posting Guidelines actually get FEWER responses?).
Aug 29 '07 #2
phopman
26 New Member
Sorry about my bad title description. My english is lacking sometimes...
Aug 29 '07 #3
rpnew
188 New Member
hi.. i'm not sure but try this..
[PHP]
$thisfile ="index.php?option=com_content&task=view&" . "id=" . "$id" . "&Itemid=" . "$itemid";
[/PHP]

instead of...

[PHP]
$thisfile ="http://192.168.1.38/demotest/index.php?option=com_content&task=view&" . "id=" . "$id" . "&Itemid=" . "$itemid";
[/PHP]

if you are accessing the page from the same directory then you dont need to provide whole path to the file......
Aug 31 '07 #4
phopman
26 New Member
Thanks rpnew for the tip. I found out that if I had action ="" the script worked. Somehow...
Sep 3 '07 #5
pbmods
5,821 Recognized Expert Expert
Heya, Phopman.

Did you set a base href for the page? That might have thrown things off a bit.

For example, if your script were located at /forms/update.php, but your base href were http://yoursite.tld/, then you would run into problems:
Expand|Select|Wrap|Line Numbers
  1. <form action="update.php">
  2.  
Would attempt to post to /update.php, not /forms/update.php.

However,
Expand|Select|Wrap|Line Numbers
  1. <form action="">
  2.  
Posts to the same page... I think. I don't think it's part of a standard, but all browsers seem to implement it that way. But I don't like to trust it, which is why I usually use the basename(__FILE__) trick (though that won't work, as you can see, with a base href).
Sep 3 '07 #6
phopman
26 New Member
No, I did not set a Base Href, only "".

Man, sometimes I just hate PHP. But I love it too. Mastering it a little by little give me satisfaction...
Sep 4 '07 #7

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

Similar topics

8
6546
by: Greg A | last post by:
Hi: I have my index.php page. For the header, sidebar, and footer, those are separate php pages that I call into the index.php page. My sidebar.php page has a form in it, that works fine if...
1
4172
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...
1
4295
by: Orest Kinasevych | last post by:
Okay, I made sense of the earlier suggestions and realized I was on the right track -- I appreciate the feedback which got me to this point. The suggestions posted here indeed worked and...
3
2832
by: Skippytpe | last post by:
Does anyone have an idea why the form validation in the following page wouldn't be working? I had been using XHTML 1.0 transitional which allowed me to use the form attribute 'name.' I could then...
11
18797
by: Jozef | last post by:
I have some old code that I use from the Access 95 Developers handbook. The code works very well, with the exception that it doesn't seem to recognize wide screens, and sizes tab controls so that...
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...
2
3173
by: Vinod I | last post by:
Hi Team, When I tryed following code, I am getting the Runtime Error as "The View State is invalid for this page and might be corrupted." Exception Details: System.Web.HttpException: The View...
3
2645
by: underground | last post by:
I found this form on the scripts. However when I attemp to open the php file on the sever I get a error message Parse error: syntax error, unexpected $end on line 238 <? /** * Main.php * *...
7
16113
by: jeddiki | last post by:
Hi, As I am in Turkey at present, I can not see vidoes on youtube. So I have tried a few proxies but keep finding them slow or not working. So I have installed myphpProxy on my server under...
0
7037
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
6904
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
7076
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...
1
6732
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...
0
5324
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
2990
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...
0
2976
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
558
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
174
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...

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.