Hi, short question again.. I have a simple form: <form id="form" name="form" method="post" action="/"> <input name="field" id="textfield" value="Foldername" type="text"> PHP: How can i make the action going to /Foldername instead /?Field=Foldername Thanks in advance,
try adding a "/" to the folder name. action="../folder/" Code (markup): and have an index.php (or index.html) file in that folder handle the request.
hm, that doesn't seem to work.. my index.php handles the request, so i still get /?Field=Folder1345 any more ideas? Thx
In the .htaccess file add the following: php_flag register_globals on RewriteEngine on RewriteRule ^folder-(.*)$ index.php?Field=$some_var [QSA] Code (markup): The $some_var should be the same as the one in your php script. The will give the effect of sending the form to the folder but you are really sending it a script. This is also more search engine friendly.
Hey thanks, this is the button code i use: <form id="form" name="form" method="get" action="../"> <input type="text" name="Field" value="/" /> <input type="image" alt="Button" src="/images/button.jpg" /> PHP: The problem i have now: /?Field=blablabla&x=0&y=0 Code (markup): ...Where does the x=0&y=0 come from??
Looking at your code you made a mistake in the image button code. <input type="image" alt="Button" src="/images/button.jpg" /> Code (markup): is meant to look like this: <input type="image" name="submit" alt="Button" src="/images/button.jpg" /> Code (markup): I think that should work... And I'm guessing the x=0&y=0 are because of the code but I'm not 100% on that... If that fails just change the code to: <input type="submit" name="submit" value="submit" /> Code (markup):
Hey thanks.. i changed the type to input, getting this url after submit: ht*p://domain.com/?Field=blabla So i have to redirect that url to domain.com/blabla in the .htaccess now? How to do that?
ok create a .htaccess file and put the following in it: RewriteEngine on RewriteBase / RewriteRule (.*)$ index.php?Field=$some_var Code (markup): so when you enter http://domain.com/?Field=blabla Code (markup): you should rather use http://domain.com/blabla Code (markup): The .htaccess file hides parts of the true URL and make it look like http://domain.com/blabla Code (markup):
(above <HTML><HEAD> etcsection of HTML) <?php $field = $_POST['field']; (write the field to folder with fopen and append) I dont know why you want to add a .txt like that to a folder though. Doesnt makemuch sense. Look at how to read, write and append to .txt files it will let you select the folder and even create a new .txt file with a name you specify its basic code, and i aint writing it all here. ?> // In the Body of HTML <form id="form" name="form" method="post" action="index.php"> <input name="field" id="textfield" value="Foldername" type="text"> //NEW <input type="submit" value="Submit this form" onclick="this.form.submit">