Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Dec 2006
    Posts
    306
    Thanks
    24
    Thanked 0 Times in 0 Posts

    Create a dynamic url

    Hi;
    I want to create a dynamic URL by using mod_rewrite, to let user post their thread like this forum does.

    And i want to rewrite my all request as following:
    code:
    domain.com/form and Mod_Rewrite -> domain.com/index.php?topic=form and Mod_Rewrite

    In the .htaccess file, i wrote the rewite rule as following:
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.+)?$ index.php?name1=$1 [L]

    But the problem for me is after a user type his topic for his new thread, how i get the value of the topic and put it into
    action, let the action="value of the topic". For example, if the value of the topic is "how to use mod_rewrite", then
    i want the action="how to use mod_rewrite".


    Could anybody give me some idea how to do that by php. Thanks


    <html>
    <body>
    <form name="input" action="????????" method="get">
    <input type="text" name="topic" value="type your topic here" size="20">
    <br>
    <textarea rows="10" cols="30"> Type your massage here </textarea>
    <br>
    <input type="submit" value="Submit">

    </form>
    </body>
    </html>

  • #2
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    You can dynamically assign your form attributes using Javascript...

    Code:
    <form name="input" method="get">
    <input type="submit" name="formSubmit" value="post message" onsubmit="document.input.action = document.formSubmit.value;">
    (not tested)

  • #3
    Regular Coder
    Join Date
    Dec 2006
    Posts
    306
    Thanks
    24
    Thanked 0 Times in 0 Posts
    Thanks a lot.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •