Jump to content

Form values writing URL to pdf file


ryanyoungsma

Recommended Posts

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 example

www.mywebsiteexample.com\cy\pnc\annual\mda12345.pdf

Is 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 &amp; 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

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. 
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]<?php
if(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 &amp; 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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.