Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

Specifying PHP file path while creating an HTML form

html form file-path absolute or relative?

This topic has been archived. This means that you cannot reply to this topic.
2 replies to this topic

#1 gvvishwanath

gvvishwanath

    CC Lurker

  • Just Joined
  • Pip
  • 2 posts

Posted 30 December 2015 - 08:36 PM

I am trying to design a registration form using HTML, CSS, MySQL , JS and PHP.

All related files are inside one folder : Registration Form.

In my HTML form page, when I specify the form with its absolute path:

                 <form name="regform" action="http://localhost/Registration Form/register.php " method="post" target="_blank" onsubmit = 'return validate() '/>

the PHP file opens and works as I expect it to.

 

But when I change the path to relative, as:

               <form name="regform" action="http://./register.php" method="post" target="_blank" onsubmit = 'return validate() '/>

the browser shows "about:blank".

 

I want  to use relative path as far as possible, to make this "independent of storage place" in a way. Could you help me out?

 

PS:  I am able to use relative path for including stylesheets and JS files.

Moreover, I am able to "include" other PHP files using relative path, in the above mentioned "register.php" file!

I am working on an Ubuntu Linux system and the browser is Firefox.



#2 BlueBox

BlueBox

    CC Lurker

  • New Member
  • Pip
  • 4 posts

Posted 03 January 2016 - 07:28 AM

   <form name="regform" action="http://./register.php" method="post" target="_blank" onsubmit = 'return validate() '/>

 

We dont use protocols to have relative path. So there should not any http:// or https:// in that. 

 

So, if you want to use the relative path:

a) If your parent file is in same folder as that of file that contain your form use 

<form name="" action="form.php"> ... </form>

b ) Your parent file is in different folder 

<form name="" action="./form.php"> ... </form>

This will solve your problem.


Edited by BlueBox, 03 January 2016 - 07:28 AM.


#3 gvvishwanath

gvvishwanath

    CC Lurker

  • Just Joined
  • Pip
  • 2 posts

Posted 03 January 2016 - 10:22 PM

Thanks.






Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download