Jump to content

JDPerry

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

JDPerry's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. [!--quoteo(post=366543:date=Apr 19 2006, 01:39 PM:name=poirot)--][div class=\'quotetop\']QUOTE(poirot @ Apr 19 2006, 01:39 PM) [snapback]366543[/snapback][/div][div class=\'quotemain\'][!--quotec--] Does it actually outputs your variable? I mean, when you open your page, what exactly you see <INPUT TYPE="hidden" NAME="EmpNum" VALUE="**HERE**"> ? [/quote] There are other variables that are passed, I only reference the one I am having problems with. One the receivng page I put a loop to display the passed values so I could check them over and it shows the following: EmpNum, EmpID, JSmith PeriodID, 2 For some reason it always display as a blank. The EmpID, and PeriodID are post variables that I just carry over from the previous page, the EmpNum I am trying to get through the query.
  2. [!--quoteo(post=366517:date=Apr 19 2006, 12:49 PM:name=Dobakat)--][div class=\'quotetop\']QUOTE(Dobakat @ Apr 19 2006, 12:49 PM) [snapback]366517[/snapback][/div][div class=\'quotemain\'][!--quotec--] well i am not sure if you were aware or not, but there is a ' missing in: [code] $link = mysql_connect (hosthost','database_name','password') OR die('problem w/ link'); [/code] it should be: [code] $link = mysql_connect ('hosthost','database_name','password') OR die('problem w/ link'); [/code] [/quote] Those are actually just generic, I was afraid to post the actual info on the web. Do you have any other suggestions as to why the variable would be blank. I am struggling to see what I am doing wrong.
  3. [!--quoteo(post=366444:date=Apr 19 2006, 09:55 AM:name=poirot)--][div class=\'quotetop\']QUOTE(poirot @ Apr 19 2006, 09:55 AM) [snapback]366444[/snapback][/div][div class=\'quotemain\'][!--quotec--] Try to change this: [code]while($row = mysql_fetch_array($result)){ Extract($result); $EmpNum = $result; }[/code] To this: [code]while ($row = mysql_fetch_array($result)){    $EmpNum = $row['EmpNum']; // Or whatever the field's name is. }[/code] Obviously $EmpNum will be the last row's value if there is more than 1 row retrieved. [/quote] I tried changing that to your suggestion but it didn't work. It pass the variable name "EmpNum" but the value is always blank. I have some other variable on the page that seem to post properly but for some reason that one will not. Short of my query find no results do you have any other suggestions?
  4. I am using the code below to try and pass a variable to the next page. It is the second part of an IF statement. I am sure that my connection to the database is correct and that the post variable from the previous page is available I think the way I have constructed my query, or the way I am trying to pass it is not correct. My code is listed below: echo "<form action = 'report_module.php' METHOD = 'POST'>"; echo "<table align 'center'>"; echo "<tr>"; echo "<td>"; $link = mysql_connect(hosthost','database_name','password') OR die('problem w/ link'); mysql_select_db('fareport_far') or die('could not select database'); $query = "SELECT * FROM UserInfo WHERE EmpID = '{$HTTP_POST_VARS['EmpID']}'"; $result = mysql_query($query) or die('query2 failed'.mysql_error()); $row = mysql_fetch_array($result); while($row = mysql_fetch_array($result)){ Extract($result); $EmpNum = $result; } mysql_close($link); echo "</tr>"; echo "</td>"; echo "<tr>"; echo "<td>"; print ("<INPUT TYPE=\"hidden\" NAME=\"EmpNum\" VALUE=\"$EmpNum\">\n"); echo "<INPUT TYPE='submit' VALUE='View Faculty Report'>"; echo "</tr>"; echo "</td>"; echo "</table>"; echo "</form>"; Any help would be greatly appreciated.
  5. I have set up two drop down boxes on a form and when I submit the form the values that are passed are the last values in the list, not the selected value. What is the proper code to pass the selected variables. [!--coloro:#FF6666--][span style=\"color:#FF6666\"][!--/coloro--] This is the selection[!--colorc--][/span][!--/colorc--] //Create a selection list for the UserInfo table echo "<select name = 'EmpNum'>\n"; echo "<option value = '0'>Select a User\n"; //Retreive data until all results collected from UserInfo while($row = mysql_fetch_array($result)) { extract($row); echo "<option value = $EmpNum>$Fname $Lname\n"; } echo "</select>\n"; echo "<br></br>"; echo "</td>"; [!--coloro:#FF6666--][span style=\"color:#FF6666\"][!--/coloro--]This is how I am trying to pass it[!--colorc--][/span][!--/colorc--] print ("<INPUT TYPE=\"hidden\" NAME=\"EmpNum\" VALUE=\"$EmpNum>$Fname $Lname\">\n"); print ("<INPUT TYPE=\"hidden\" NAME=\"PeriodID\" VALUE=\"{$HTTP_POST_VARS['PeriodID']}\">\n"); echo "<tr>"; echo "<td><input type='submit' value='View Report'>"; echo "</td>"; Any help would be greatly appreciated.
  6. I am typing the code below to pass two variables from two selection boxes to a page titled "pass_test.php". The selection boxes are based on databases. When you look at the web page is displays propertly and let users select the name and the empnum but when you hit the submit button it send value for the last row in each database. I am new to both PHP and HTML so I think it is something I have structure incorrectly. The link to the database works fine but my variable won't post. Any help would be appreciated. thanks JDPerry <html> <center> <?php //Get all the data from the "Period" Table $result = mysql_query("SELECT * FROM Period") or die (mysql_error()); //Get data from the "UserInfo" Table $result2 = mysql_query("SELECT * FROM UserInfo ORDER BY Lname") or die (mysql_error()); //Create a selection list for the UserInfo table echo "<select name = 'EmpNum'>\n"; echo "<option value = '0'>Select a User\n"; //Retreive data until all results collected from UserInfo while($row = mysql_fetch_array($result2)) { extract($row); echo "<option value = $EmpNum>$Fname $Lname\n"; } echo "</select>\n"; echo "<br></br>"; //Create a selection list for the Period table echo "<select name = 'PeriodID'>\n"; echo "<option value = '0'>Select a Reporting Period\n"; //Retreive data until all results collected from PERIOD while($row = mysql_fetch_array($result)) { extract($row); echo"<option value = $PeriodID>$PeriodDesc\n"; } echo "</select>\n"; echo "<br></br>"; print ("</TABLE>\n"); print ("<form action=\"pass_test.php\" METHOD=\"POST\">\n"); print ("<INPUT TYPE=\"hidden\" NAME=\"EmpNum\" VALUE=\"{$HTTP_POST_VARS['EmpNum']}\">\n"); print ("<INPUT TYPE=\"hidden\" NAME=\"PeriodID\" VALUE=\"{$HTTP_POST_VARS['PeriodID']}\">\n"); print ("<INPUT TYPE=\"submit\" VALUE=\"View Report\">\n"); print ("</form>\n"); print ("</CENTER>\n"); ?> </center> </html>
×
×
  • 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.