Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Showing results for
Problem with form submit - was working before
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Plusnet Community
- :
- Forum
- :
- Help with my Plusnet services
- :
- Everything else
- :
- Problem with form submit - was working before
Problem with form submit - was working before
16-03-2010 11:24 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
I have a problem with form submission. I've made a minimal example to see if anyone can see the problem. It worked last week before the upgrade:
'submitCheck' always returns false and so the form always shows. Any ideas?
<?php
if(!isset($_POST['submitCheck']))
{
// show form
?>
<html>
<body>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<input name="submitCheck" type="hidden" value="sent" />
<input name="submit" type="submit" value="Submit" />
</form>
</body>
</html>
<?php
}
else
{
echo 'form sent';
}
?>
'submitCheck' always returns false and so the form always shows. Any ideas?
Message 1 of 6
(1,196 Views)
5 REPLIES 5
Re: Problem with form submit - was working before
16-03-2010 11:39 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
I think the suggestion in the long thread here might help explain the problem. But note that there are important follow up posts later in the thread.
Once you have this working a post here to explain what you did would be helpful.
David
Once you have this working a post here to explain what you did would be helpful.
David
David
Message 2 of 6
(467 Views)
Re: Problem with form submit - was working before
17-03-2010 12:04 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Thanks a lot David.
The link you provided says the problem is with 'PHP_SELF' and it is. It suggested trying 'SCRIPT_URL'. I quick search suggests it should say 'SCRIPT_URI' but this led me to 'SCRIPT_NAME' which works (currently anyway). If this is not a good idea for any reason I'll just hard-code the file name. Thank again,
Barry.
The link you provided says the problem is with 'PHP_SELF' and it is. It suggested trying 'SCRIPT_URL'. I quick search suggests it should say 'SCRIPT_URI' but this led me to 'SCRIPT_NAME' which works (currently anyway). If this is not a good idea for any reason I'll just hard-code the file name. Thank again,
Barry.
Message 3 of 6
(467 Views)
Re: Problem with form submit - was working before
17-03-2010 1:47 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Thanks for the feedback.
'SCRIPT_NAME' includes the /~username prefix, but if it works OK with this variable that's fine. It should have worked with 'SCRIPT_URL' which is the relative path from the HTTP root, excluding the /~username prefix.
David
'SCRIPT_NAME' includes the /~username prefix, but if it works OK with this variable that's fine. It should have worked with 'SCRIPT_URL' which is the relative path from the HTTP root, excluding the /~username prefix.
David
David
Message 4 of 6
(468 Views)
Re: Problem with form submit - was working before
17-03-2010 9:23 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Quote from: ratbag this led me to 'SCRIPT_NAME' which works (currently anyway).
That's confusing me because, as David mentions, _SERVER["SCRIPT_NAME"] will contain the /~username. It would work with GET, but not POST.
Gabe
Message 5 of 6
(468 Views)
Re: Problem with form submit - was working before
17-03-2010 9:32 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
$_SERVER['SCRIPT_URL'] is the correct one to use. We are also looking in to getting it working with PHP_SELF, however if you need the script working ASAP it's best to use SCRIPT_URL.
Message 6 of 6
(468 Views)
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Plusnet Community
- :
- Forum
- :
- Help with my Plusnet services
- :
- Everything else
- :
- Problem with form submit - was working before