Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6811049
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:16:48+00:00 2026-05-26T20:16:48+00:00

I am trying to get a HTML/PHP form to submit properly. Some details: base

  • 0

I am trying to get a HTML/PHP form to submit properly. Some details:

base url = http://localhost/directory

page = page/add

complete address = http://localhost/directory/page/add

Using htaccess to rewrite urls so http://localhost/directory/page/add is actually http://localhost/directory/index.php?q=page/add

My HTML POST action is “page/add” so that the front controller knows which function to fire to sanitize and submit the data (it acts as a ‘form id’).

The page loads fine at http://localhost/directory/page/add but when I click on the submit button, the URL gets mangled to page/page/add. And every time I press “submit” I get another “page” added to the url. So 5 clicks will get “page/page/page/page/page/page/add”

I can’t seem to find why I am getting that “extra” “page”.

The actual PHP error (page/page/add doesn’t exist in $routes since it isn’t a valid route):

Notice: Undefined index: page/page/add in C:\xampp\htdocs\script\includes\common.inc on line 92

Here is the function at line 92:

function route_path($path = NULL) {

    $routes = get_routes(); //Returns array: approved "urls => function callbacks"

    if($path === NULL) {
        $path = get_path(); //Returns $_GET['q'] with trim and strip_tags
    }

    $function = $routes[$path]; <<<<<----This is LINE 92 

    if(isset($function)) {
    $form_name = str_replace('/', '_', $path); // page/add = function page_add()
    }

    if(function_exists($function)) {
        call_user_func($function, $form_name);
    }
    else {
        //TODO: Redirect to Login screen.
    }
}

The basic HTML is:

<form action="page/add" method="post" />

//Form elements

<input type="submit" value="Submit" />
</form>

Thanks for the help.

UPDATE: What I did was add the <base> tag to my HTML templates. This allows me to keep the action as page/add (since it is also a route in my simple router/dispatcher).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T20:16:48+00:00Added an answer on May 26, 2026 at 8:16 pm

    By using a relative path, you’re telling the form to submit at the existing path plus your action. So if you are at http://example.com/page/add, the form uses http://example.com/page/ as a base and adds the action page/add resulting in a POST to http://example.com/page/page/add.

    You can still use a relative path, just change the action accordingly:

    <form action="add" method="post" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently trying to get users to submit data via PHP/HTML forms and into
I'm trying to get an html page to display an XML file formatted with
I am trying to get some content in html documents. Some of the documents
I am trying to get some JavaScript to programmatically adjust a HTML img tag's
So, I'm trying to get my html form hosted on the company I work
Here is my html form <div id=create> <form action=index.php method=get id=createform> <input type=text name=urlbox
I need some help I am trying to create a PHP form using sqlite3
I'm trying to get a HTML source of a website through C# code. When
I'm trying to get the HTML of a selected object with jQuery. I am
I am trying to get the html value of a linked clicked. The links

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.