tags:

views:

96

answers:

3

Hey all, 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>
+5  A: 

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

seengee
Maybe he should post the full HTML page, the only way $_POST won't populate is because he did not set the method to post.
rmontagud
www.markonsolutions.com/apply.php is the full html page that this thing starts on
Crash893
This was actually very helpfull
Crash893
did you fix the problem?
seengee
Yea but I'm not sure what it was after I used your code I rewrote all the posts that were acting up and now it works
Crash893
A: 

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?

gaoshan88
sorry if i was unclear. I am doing that but some work and some do not. I am unclear as to why the ones that don't work are broken.
Crash893
In that case, on the page you are posting to do what seengee suggests and run print_r($_POST) (and throw the <pre> tags around it as suggested. This will make it more readable). This will display all of your available $_POST variables.
gaoshan88
A: 

Depending on your version of PHP you may not be able to echo out a variable declared on the fly.

you did

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

Notice how jobname = $_POST...? You cannot do it that way. Do it as follows:

$clearance = $_POST["clearance"];
echo $clearance;
alisemail
I am able to do thatThe echo was a trouble shooting idea i had to see if it was not being picked up at the post or if it was getting messed up later in the code. I tracked it down to not being able to post
Crash893
$experince = $_POST["exp"]; I think that's suppose to be $experience = $_POST["experience"]; or $exp = $_POST["exp"];
Newb
If that is true php is retarded. Ill give it a try when i get into work
Crash893