Question

I'm still pretty new to php so I'm a little shaky on getting the post value for things across pages.

I have an online application that I am making and so far its mostly working but im running into a problem with 3 fields that seem to not want to transfer over no matter what I do.

I have other variable I'm getting in what i see to be the exact same way that are working fine and yet these three are giving me trouble

Can anyone point out what I'm doing wrong?

php code thus far

$notes = $_POST["notes"];

echo "<br>experince <br>";
echo $experince = $_POST["exp"];<--------------

$education = $_POST["education"];
echo "<br>clearnce <br>";
echo $clearance = $_POST["clearance"]; <-----------------
echo "<br>jobname <br>";
echo $jobname = $_POST["jobname"];<--------------

$name = $_POST["username"];
$phone= $_POST["phone"];
$email= $_POST["email"];
$avail =$_POST["availability"];
$subject = "New Online Application: $jobname " ;
$subject .= rand(1000,9999);

the html/php code that the valuses come from

Select a Level of Education:<br />
    <select name="education">
        <option value="None">None</option>
        <option value="HighSchool">HighSchool</option>
        <option value="BA/BS">BA/BS</option>
        <option value="MA/MS">MA/MS</option>
        <option value="MBA">MBA</option>
        <option value="Ph.D">Ph.D</option>
        <option value="Other">Other</option>
    </select>
    <br>
    <br>
        Years of Experince:<br />
    <select name="exp">
        <option value="0-4">0-4</option>
        <option value="5-10">5-10</option>
        <option value="11-20">11-20</option>
        <option value="20+">20+</option>
    </select>
    <br>
    <br>
    Select a Clearance Level:<br />
    <select name="clearance">
        <option value="None">None</option>
        <option value="Confidential">Confidential</option>
        <option value="Secret">Secret</option>
        <option value="Top Secret">Top Secret</option>
        <option value="TS/SCI">TS/SCI</option>
        <option value="TS/SCI Counter Inteligence Polygraph">TS/SCI Counter Inteligence Polygraph</option>
        <option value="TS/SCI Full Scope Polygraph">TS/SCI Full Scope Polygraph</option>
        <option value="Other">Other</option>
    </select>
    <br>
    <br>
    Select Job your Intrested in:<br>
    <?php
    $files = glob("./jobops/*.pdf");
    sort($files);
    print("<select name=\"jobname\">");
    foreach ($files as &$file)
    {
        $Jobname =substr($file,0,strlen($file)-4);
        $Jobname = str_replace("./jobops/","",$Jobname);
        print("<option value=\"$Jobname\">$Jobname</option>\r\n");
    }
    print("<option value=\"Other\">Other</option>");
    print("</select>");
    ?>
    <br>
Was it helpful?

Solution

it would help if you posted the rest of your form code. anyways, something worth trying as the first level of debugging with forms is the following code on the page you are posting to:

<pre>
<?php print_r($_POST);?>
</pre>

This will at least make it clear what variables are being POSTed to your script

OTHER TIPS

What are you trying to do? It looks like you are trying to have someone fill in data and then post it to another page... yes? If so you need to use a form to post the data to somewhere and then you can access the posted data via $_POST[].

So on the form page:

<form name="myForm" method="post" action="someotherpage.php">
    <select name="education">
        <option value="None">None</option>
        <option value="HighSchool">HighSchool</option>
    </select>
    <input name="submit" type="submit">
</form>

Then over on someotherpage.php you output the posted value for "education":

<?php
echo $_POST['education'];
?>

Does that help?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top