Jump to content

Load Variables into form


Ben Phelps

Recommended Posts

I want to load the variable in this table/form

[code]<table width='100%' cellspacing='1'>
<tr>
  <td class='style1'><b>Script Location<br>
</b>
  <span class="description">Please make sure it starts with http:// and also it is the address of all your files ie. http://www.yoursite.com/upload/ Including  trailing slash</span></td>
  <td class='pformright'><input name='location' type='text' id="location" size="60"></td>
</tr>
  <tr>
    <td class='style1'>Site Title<br />
        <span class="description">This will be the title of your site. This will be displayed in the browser window. </span></td>
    <td class='pformright'><input name="title" type="text" id="title" size="60" /></td>
  </tr>
  <tr>
    <td height="54" class='style1'><p>Max Files Size <span class="description"><br />
      This should be a numeric value. The user will get an error if trying to upload a files over x megabytes.</span></p></td>
    <td class='pformright'><label>
      <input name="max" type="text" id="max" size="60" />
    </label></td>
  </tr>
  <tr>
    <td class='style1'>Delete old files after this many days<span class="description"><br />
      This should be a numeric value. Any files not downloaded after x number of day will be deleted. </span></td>
    <td class='pformright'><input name="old" type="text" id="old" size="60" /></td>
  </tr>
  <tr>
    <td class='style1'>Download timer in seconds<span class="description"><br />
      The amount of time a user must wait before receiving a download link.</span></td>
    <td class='pformright'><input name="timer" type="text" id="timer" size="60" /></td>
  </tr>
  <tr>
    <td class='style1'>Email Option<span class="description"><br />
      This will allow the user to email them self's the download information.</span></td>
    <td class='pformright'><label>
      <select name="email" id="email">
        <option value="true" selected="selected">Yes</option>
        <option value="false">No</option>
      </select>
    </label></td>
  </tr>
  <tr>
    <td class='style1'>Description Option<br />
        <span class="description">This will allow the user to add a description to the file. This description will show under the file name on the download page. </span></td>
    <td class='pformright'><select name="descr" id="descr">
      <option value="true" selected="selected">Yes</option>
      <option value="false">No</option>
    </select></td>
  </tr>
  <tr>
    <td class='style1'>Language<br />
        <span class="description">Choose Your Language . </span></td>
    <td class='pformright'><select name="lang" id="lang">
      <option value="english" selected="selected">English</option>
      <option value="french">French</option>
      <option value="german">German</option>
      <option value="italian">Italian</option>
      <option value="portuguese">Portuguese</option>
      <option value="russian">Russian</option>
      <option value="spanish">Spanish</option>
      <option value="hacker">H4X0R</option>
    </select></td>
  </tr>
 
  <tr>
    <td class='style1'>Short URL<br />
        <span class="style4">This will enable or disable the short url option, leave this alone unless you know what your are doing. </span></td>
    <td class='pformright'><select name="short" id="short">
      <option value="true">Enabled </option>
      <option value="false" selected="selected">Disabled</option>
    </select></td>
  </tr>
  <tr>
    <td class='style1'>Admin Password<span class="description"><br />
      This is the password to the admin section.</span></td>
    <td class='pformright'><input name="admin" type="text" id="admin_pass" size="60" /></td>
  </tr>
</table>[/code]

Here are the Variables
[code]
<?php
$lang = 'english';
$is_installed = 'YES';
$scripturl =  'http://osphp.net/XFH/';
$ScriptTitle = 'XtraFileHostDemo';
$maxfilesize = '5.5';
$deleteafter = '15';
$downloadtimer = '5';
$emailoption = 'true';
$descriptionoption = 'true';
$short_url = 'false';
$adminpass = 'password';
?>[/code]
See if you get this examples:
[code]

<?php

// example email

$eml_list = "";
$eml_options = array("true"=>"Yes","false"=>"No");
foreach($eml_options as $key => $value)
{
if($emailoption == $key) $selected_eml = "selected=\"selected\""; else $selected_eml = "";
$eml_list .= "<option value=\"$key\" $selected_eml>$value</option>";
}

echo <<<_HTML

<select name="email" id="email">
$eml_list
</select>

_HTML;


// example language

$lang_list = "";
$lang_options = array("english","french","german","italian","portugese","russian","spanish","hacker");
foreach($lang_options as $key)
{
if($lang == $key) $selected = "selected=\"selected\""; else $selected = "";
if($key == "hacker") $name = "H4X0R"; else $name = ucfirst($key);
$lang_list .= "<option value=\"$key\" $selected>$name</option>";
}

echo <<<_HTML

<select name="lang" id="lang">
$lang_list
</select>

_HTML;

?>

[/code]

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.