br3nn4n Posted April 14, 2010 Share Posted April 14, 2010 Hey guys, Haven't been to the forum in a bit, looks good! I'm trying to figure out how to do this. I have a site that simply goes to whatever page based on what the "p" variable is in the query string. So, for instance if I want the upload page, I go to "http....../?p=upload" Make sense? Well that "p=upload" tells it to read the contents of the txt file named "upload". I know, not super secure but that's assuming someone can find the folder the txt files are stored in. Anyway, I want to submit a form to that page, the "p=upload" one. The p is obviously a GET variable, but I need to submit a form via POST, to upload a file. I can't think what to set the form's "action" attribute to so that it will trigger the PHP code (the part that actually does the upload) which is at the top of the "upload.txt" file. I hope that makes sense! Any tips....as always, appreciated! Link to comment https://forums.phpfreaks.com/topic/198572-submit-form-to-puploaddoupload/ Share on other sites More sharing options...
ChemicalBliss Posted April 15, 2010 Share Posted April 15, 2010 If you can edit the upload script just add this (Assuming the element name of the one u want is a lowercase p): $_GET['p'] = $_POST['p']; Otherwise you will need a little javascript to actually submit the form to a custom url rather than the one specified in the action attribute of the form element. -cb- Link to comment https://forums.phpfreaks.com/topic/198572-submit-form-to-puploaddoupload/#findComment-1042131 Share on other sites More sharing options...
Sergey Popov Posted April 15, 2010 Share Posted April 15, 2010 Answering to your question: you can set form's action attribute to either your url http....../?p=upload or have the "p" parameter passed as hidden field value, then within PHP script do as ChemicalBliss suggested. Version 1: <form method="post" action="http....../?p=upload"> ... </form> Version 2: <form method="post" action="http....../"> <input type="hidden" name="p" value="upload"> ... </form> Link to comment https://forums.phpfreaks.com/topic/198572-submit-form-to-puploaddoupload/#findComment-1042243 Share on other sites More sharing options...
Deoctor Posted April 15, 2010 Share Posted April 15, 2010 u can do one thing.. write the code in a single php file(page1.php) and put the form action as the page2.php the page2.php should be some thing like this <?php include("page1.php"); ?> so by this u are calling the entire page1.php again.. hope this works Link to comment https://forums.phpfreaks.com/topic/198572-submit-form-to-puploaddoupload/#findComment-1042276 Share on other sites More sharing options...
efficacious Posted April 15, 2010 Share Posted April 15, 2010 that whole question and the responses following it are very confusing 8( op is offline i'll wait for response Link to comment https://forums.phpfreaks.com/topic/198572-submit-form-to-puploaddoupload/#findComment-1042280 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.