Jump to content

clean url and forms


MDanz

Recommended Posts

I've recently used mod_rewrite and changed my .htaccess allowing clean urls.  Is there a tutorial that tells me how to use $_GET with a clean url?

 

for instance how do i get the name with the clean url($_GET method)?

 

messy url

example.com/play.php?id=203&name=test

 

clean url

example.com/videos/play/203/test

 

 

also when using forms is it as simple as changing

<form action='submit.php' action='get'>

to

<form action='submit' action='get'>

or do i have to do something else?

 

 

Link to comment
Share on other sites

Your clean URL should rewrite all the variables into the messy URL so you won't have to do anything with the $_GET. As for as the PHP script is concerened, it dosn't matter if it was a clean URL or messy.

 

Forms are a different matter though, the action needs to be the working clean URL (not just 'submit'). If you're using GET forms then it will always look ugly. If you have several fields to submit try using POST where you can have a clean URL as the action, and all of the post data will be hidden from the URL. Depends what sort of data you're submitting in the form.

Link to comment
Share on other sites

Your clean URL should rewrite all the variables into the messy URL so you won't have to do anything with the $_GET. As for as the PHP script is concerened, it dosn't matter if it was a clean URL or messy.

 

Forms are a different matter though, the action needs to be the working clean URL (not just 'submit'). If you're using GET forms then it will always look ugly. If you have several fields to submit try using POST where you can have a clean URL as the action, and all of the post data will be hidden from the URL. Depends what sort of data you're submitting in the form.

 

Thanks for help.

 

So your saying example.php?name=test and example/name/test.. if i use $_GET['name']; on the clean url it will be "test"?..

 

and i should change my GET forms to POST(hidden data), for the sake of clean urls?

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.