ryanyoungsma Posted December 21, 2006 Share Posted December 21, 2006 Hi All, New to this forum, and was wondering of someone could point me in the right direction. I a large number of pdf files out on a server that I want customers to be able to get to without listing them all out. There are different documents based on a specific number, year, type, and dataset. The document url can be finished by pulling the data below. For examplewww.mywebsiteexample.com\cy\pnc\annual\mda12345.pdfIs PHP the correct application to write this in or would it be better suited for something else? If PHP is the right app, then any idea what the code might look like or a source when I can research it more? Thank you for all your help in advance!Ryan[code]<form id="form1" name="form1" method="post" action=""> <label>Year <select name="select" tabindex="1"> <option value="CY">2005</option> <option value="PY">2004</option> </select> </label> <p> <label>Product <select name="select2" tabindex="2"> <option value="Property & Casualty">PNC</option> <option value="Life, Accident & Health">LAH</option> </select> </label> </p> <p> <label>Statement <select name="select2" tabindex="3"> <option value="annual">Annual</option> <option value="quarterly" selected="selected">Quarterly</option> </select> </label> </p> <p> <label>Document <select name="select2" tabindex="3"> <option value="MDA">Management Discussion & Analysis</option> </select> </label> </p> <p> <label>Company Code <input type="text" name="textfield" tabindex="4" /> </label> </p> <p> <label> <input type="submit" name="Submit" value="Submit" tabindex="5" /> </label> </p></form>[/code] Link to comment https://forums.phpfreaks.com/topic/31494-form-values-writing-url-to-pdf-file/ Share on other sites More sharing options...
complex05 Posted December 21, 2006 Share Posted December 21, 2006 You are on the right track. For that form you just created, use this php code.<?header("location: http://www.yourdomain.com/" . $_POST['select'] . "/" . $_POST['select2'] . "/" . $_POST['textfield'] . ".pdf");?> Link to comment https://forums.phpfreaks.com/topic/31494-form-values-writing-url-to-pdf-file/#findComment-145885 Share on other sites More sharing options...
ryanyoungsma Posted December 21, 2006 Author Share Posted December 21, 2006 Thanks for the quick response. Would I put this code in the actions=" " section of the code or reference the code in the actions section as separate PHP file? I am thinking the later is the correct course of action, but not sure. so it would be like<form id="form1" name="form1" method="post" target="_blank" action="url.php">Thanks again. Link to comment https://forums.phpfreaks.com/topic/31494-form-values-writing-url-to-pdf-file/#findComment-145912 Share on other sites More sharing options...
craygo Posted December 21, 2006 Share Posted December 21, 2006 Also your second dropdown is backwards[code] <select name="select2" tabindex="2"> <option value="Property & Casualty">PNC</option> <option value="Life, Accident & Health">LAH</option> </select>[/code]should be[code] <select name="select2" tabindex="2"> <option value="PNC">Property & Casualty</option> <option value="LAH">Life, Accident & Health</option> </select>[/code]So with complex's header your script would be like so[code]<?phpif(isset($_POST['Submit'])){header("location: http://www.yourdomain.com/" . $_POST['select'] . "/" . $_POST['select1'] . "/" . $_POST['select2'] ."/".$_POST['select3'].$_POST['textfield'].".pdf");} else {?><form id="form1" name="form1" method="post" action=""> <label>Year <select name="select" tabindex="1"> <option value="CY">2005</option> <option value="PY">2004</option> </select> </label> <p> <label>Product <select name="select1" tabindex="2"> <option value="PNC">Property & Casualty</option> <option value="LAH">Life, Accident & Health</option> </select> </label> </p> <p> <label>Statement <select name="select2" tabindex="3"> <option value="annual">Annual</option> <option value="quarterly" selected="selected">Quarterly</option> </select> </label> </p> <p> <label>Document <select name="select3" tabindex="3"> <option value="MDA">Management Discussion & Analysis</option> </select> </label> </p> <p> <label>Company Code <input type="text" name="textfield" tabindex="4" /> </label> </p> <p> <label> <input type="submit" name="Submit" value="Submit" tabindex="5" /> </label> </p></form><?php}?>[/code]Ray Link to comment https://forums.phpfreaks.com/topic/31494-form-values-writing-url-to-pdf-file/#findComment-145924 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.