Jump to content

Please help I am at my limit here.


wanttoknow

Recommended Posts

ok here goes.. I am having this mental block on how to get this done. I am a new php head, so please go gental. This is what I am tring to do here:
I would like to be able to use session variables to get info from one page to another. The first page is set for the user to select info from a drop down and then select what type of form to use. This then sends them to the propper form on the page and prepopulates some fields. However, the session veriable is not being set and does not arrive at the forwarded page.

The dd250.php is not finished yet, I am just trying to get the session to load correctly first.

Thanks for everything!!



This is the entry.php page
[code]<head>
<script type="text/javascript" language="JavaScript1.2" src="includes/menu/stmenu.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" type="text/css" href="includes/css/niftyCorners.css">
<link rel="stylesheet" type="text/css" href="includes/css/niftyPrint.css" media="print">
<style type="text/css">
body{padding: 0px 0 0;background:#FFF;color:#111;
    font: 100.01%/1.3 Verdana,Arial,sans-serif;text-align:center}
div#box{width: 35em;padding: 0px  0;margin:0 auto;
  text-align:left;background: #F4BE6F url(img/sorline.gif) repeat-x center center}
h1{font: lighter 150% "Trebuchet MS", "Arial sans-serif";color: #208BE1}
h2{font: lighter 100% "Trebuchet MS", "Arial sans-serif";color: #208BE1}
h3{font: lighter 75% "Trebuchet MS", "Arial sans-serif";color: #208BE1}
h1,p{margin:0;padding:1px 16px}
h2,p{margin:0;padding:1px 16px}
h3,p{margin:0;padding:1px 16px}
</style>
<script type="text/javascript" src="includes/niftycube.js"></script>
<script type="text/javascript">
window.onload=function(){
Nifty("div#box","transparent");
}
</script>

</head>

<body>

<script type="text/javascript" language="JavaScript1.2" src="includes/menu.js"></script></td>
<div id="box">
<?php

include 'includes/db.inc';
$resultset = mysql_query("SELECT * FROM customer_info")
or die(mysql_error()); 
// store the record of the "example" table into $row

// Print out the contents of the entry
?>
  <h3><br>
    Please select what you would like to do:</h3>
  <h3><br>
  </h3>
  <form method="post" form name="formselection" action="<?php echo $PHP_SELF?>">
  <table width="51%" border="0" align="center" id="customerselect">
    <tr>
      <td height="47" nowrap>Please Select Which Customer to Ship to:</td>
      <td><select type="Text" name="id2">
          <?php  while ($row = mysql_fetch_array( $resultset ))
  {?>
          <option value="<?php printf($row["id"]); ?>"><?php printf($row["name"]); ?></option>
          <?php } ?>
        </select></td>
    </tr>
    <tr>
      <td nowrap>Please select which Form you want to use:</td></a>
      <td><select type="Text" name="formtype">
          <option value="DD250">DD250</option>
          <option value="1149">1149</option>
        </select>
        </td>
      <td> </t> <div align="right"> </div><tr>
      <td nowrap><div align="right"> </div></td>
      <td><input type="Submit" name="formselection" value="Proceed"></tr>
  </table>
  </form>
  <p>
    <center>
    </center>
    <br>
<?php

$_SESSION['id2'] = $_POST['id2'];

if($_POST['formtype'] == "1149")
{
header("Location: 1149.php");
}
elseif($_POST['formtype'] == "DD250")
{
header("Location: dd250.php");
}
echo "</div></body></html>";

} [/code]

Here is the respective form page in this case the dd250.php

[code]
<body>
<?php
session_start;
include 'includes/db.inc';
$sql = "SELECT * FROM customer_info WHERE";
$connector = "" ;
$sql = $connector.$sql." id=('".$_SESSION['id2']."')" ;
$query = mysql_query($sql) ;
printf($sql);
printf($id2);
?>
<script type="text/javascript" language="JavaScript1.2" src="includes/menu.js"></script></td>
<div id="box">
<h1>IMPACT Science & Technology Shipping Database</h1>
  <p align="center"><strong><em>DD250 Data Entry Form</em></strong>
  <form name="submit1149" method="post" action="<?php echo $PHP_SELF?>">
   
    <table width="547" border="0" align="center" id="1149">
      <tr>
        <td width="94" height="26" nowrap><font size="1">Ship To:</font></td>
        <td width="152" nowrap><font size="1">
          <input type="text" name="shipto" value=<?php printf($query["assetnumber"]); ?>>
          </font></td>
        <td width="59" nowrap><font size="1">&nbsp;</font></td>
        <td width="72" nowrap><font size="1">&nbsp;</font></td>
        <td width="140">&nbsp;</td>
      </tr>
      <tr>
        <td height="22" nowrap><font size="1">Address:</font></td>
        <td nowrap><font size="1">
          <input type="text" name="shipto">
          </font></td>
        <td nowrap><font size="1">&nbsp;</font></td>
        <td nowrap><font size="1">Carrier: </font></td>
        <td><font size="1">
          <select type="Text" name="carrier">
            <option value="ups">UPS</option>
            <option value="fedex">Fed-Ex</option>
            <option value="dhl">DHL</option>
            <option value="usps">USPS</option>
          </select>
          </font></td>
      </tr>
      <tr>
        <td height="22" nowrap><font size="1">City/State/Zip:</font></td>
        <td nowrap><font size="1">
          <input type="text" name="shipto">
          </font></td>
        <td nowrap><font size="1">&nbsp;</font></td>
        <td nowrap><font size="1">Tracking #: </font></td>
        <td><font size="1">
          <input name="shipto2" type="text" size="18">
          </font></td>
      </tr>
      <tr>
        <td height="31" nowrap><font size="1">Attention:</font></td>
        <td nowrap><font size="1">
          <input type="text" name="shipto">
          </font></td>
        <td nowrap><font size="1">&nbsp;</font></td>
        <td nowrap><font size="1">Invoice #:</font></td>
        <td><font size="1">
          <input name="shipto22" type="text" size="14">
          </font></td>
      </tr>
      <tr>
        <td valign="middle" nowrap><font size="1">Date Matl Req:</p></font></td>
        <td nowrap><font size="1">
          <input name="mtlreq" type="Text" value="" size="8" maxlength="10">
          <a href="javascript:cal1.popup();"><img src="img/cal.gif" width="16" height="16" border="0" alt="Click Here to Pick up the date" /></a></font></td>
        <td nowrap>&nbsp;</td>
        <td nowrap><font size="1">Shipment #:</font></td>
        <td><font size="1">
          <input name="shipto23" type="text" size="14">
          </font></td>
      </tr>
      <tr>
        <td nowrap><font size="1">Shipment Date:</font></td>
        <td nowrap><font size="1">
          <input name="shipdte" type="Text" value="" size="8" maxlength="10">
          <a href="javascript:cal2.popup();"><img src="img/cal.gif" width="16" height="16" border="0" alt="Click Here to Pick up the date" /></a></font></td>
        <td nowrap>&nbsp;</td>
        <td nowrap><font size="1">Invoice Date:</font></td>
        <td><font size="1">
          <input name="invoicedate" type="Text" value="" size="8" maxlength="10">
          <a href="javascript:cal3.popup();"><img src="img/cal.gif" width="16" height="16" border="0" alt="Click Here to Pick up the date" /></a></font></td>
      </tr>
      <tr>
        <td nowrap><font size="1">Contract #:</font></td>
        <td nowrap><font size="1">
          <select type="Text" name="contractnumber">
            <option value=""></option>
            <option value="Low Risk">Low Risk</option>
            <option value="Moderate Risk">Moderate Risk</option>
            <option value="High Risk">High Risk</option>
          </select>
          </font></td>
        <td nowrap><font size="1">&nbsp;</font></td>
        <td nowrap><font size="1">CLIN:</font></td>
        <td><font size="1">
          <input name="shipto222" type="text" size="14">
          </font></td>
      </tr>
      <tr>
        <td nowrap><font size="1">Delivery Order #:</font></td>
        <td nowrap><font size="1"><font size="1">
          <select type="Text" name="deliveryordernumber">
            <option value=""></option>
            <option value="Low Risk">Low Risk</option>
            <option value="Moderate Risk">Moderate Risk</option>
            <option value="High Risk">High Risk</option>
          </select>
          </font></font></td>
        <td nowrap><font size="1">&nbsp;</font></td>
        <td nowrap>&nbsp;</td>
        <td>&nbsp;</td>
        <td width="0"></font>
        <td width="10"></td>
      </tr>
      <tr>
        <td nowrap><font size="1">&nbsp;</font></td>
        <td nowrap><font size="1">&nbsp;</font></td>
        <td nowrap><font size="1">&nbsp;</font></td>
        <td nowrap>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td nowrap><font size="1">&nbsp;Unit P/N:</font></td>
        <td nowrap><font size="1">
          <select type="Text" name="unitpn">
            <option value=""></option>
            <option value="Low Risk">Low Risk</option>
            <option value="Moderate Risk">Moderate Risk</option>
            <option value="High Risk">High Risk</option>
          </select>
          </font></td>
        <td nowrap><font size="1">Qty Units:</font></td>
        <td nowrap><font size="1">
          <input name="qty" type="text" id="unitqty" size="1" maxlength="3">
          </font></td>
        <td nowrap><font size="1"> Price:
          <input name="unitprice" type="text" id="unitprice" size="8" maxlength="9">
          </font></td>
      </tr>
      <tr>
        <td nowrap><font size="1">Serial #'s:</font></td>
        <td nowrap><font size="1">
          <textarea name="serialnumber" cols="18" rows="2" id="serialnumber"></textarea>
          </font></td>
        <td nowrap><font size="1">&nbsp;</font></td>
        <td nowrap><font size="1">&nbsp;</font></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td nowrap><font size="1">&nbsp;</font></td>
        <td nowrap><font size="1">&nbsp;</font></td>
        <td nowrap><font size="1">&nbsp;</font></td>
        <td nowrap><font size="1">&nbsp;</font></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td height="62" nowrap><font size="1">Part #2&nbsp;</font></td>
        <td nowrap><font size="1">
          <select type="Text" name="select">
            <option value=""></option>
            <option value="Low Risk">Low Risk</option>
            <option value="Moderate Risk">Moderate Risk</option>
            <option value="High Risk">High Risk</option>
          </select>
          </font></td>
        <td nowrap><font size="1">Qty Part 2:</font></td>
        <td nowrap><font size="1">
          <input name="part2qty" type="text" id="part2qty" size="1" maxlength="3">
          </font></td>
        <td><font size="1">&nbsp; </font></td>
      </tr>
      <tr>
        <td height="57" nowrap><font size="1">Part #3&nbsp;</font></td>
        <td nowrap><font size="1">
          <select type="Text" name="select2">
            <option value=""></option>
            <option value="Low Risk">Low Risk</option>
            <option value="Moderate Risk">Moderate Risk</option>
            <option value="High Risk">High Risk</option>
          </select>
          </font></td>
        <td nowrap><font size="1">Qty Part 3:</font></td>
        <td nowrap><font size="1">
          <input name="part3qty" type="text" id="part3qty" size="1" maxlength="3">
          </font></td>
        <td><font size="1">Notes:</font></td>
      </tr>
      <tr>
        <td height="37" nowrap><font size="1">Part #4</font></td>
        <td nowrap><font size="1">
          <select type="Text" name="select3">
            <option value=""></option>
            <option value="Low Risk">Low Risk</option>
            <option value="Moderate Risk">Moderate Risk</option>
            <option value="High Risk">High Risk</option>
          </select>
          </font></td>
        <td nowrap><font size="1">Qty Part 4:</font></td>
        <td nowrap><font size="1">
          <input name="part4qty" type="text" id="part4qty" size="1" maxlength="3">
          </font></td>
        <td><font size="1">
          <textarea name="notes" cols="12" rows="2" wrap="VIRTUAL"></textarea>
          </font></td>
      </tr>
      <tr>
        <td nowrap><font size="1">&nbsp; </font></td>
        <td nowrap><font size="1">&nbsp;</font></td>
        <td nowrap><font size="1">&nbsp;</font></td>
        <td nowrap>&nbsp;</td>
        <td align="left" valign="middle" nowrap>&nbsp; </td>
      </tr>
    </table>
    <p>
      <input type="Submit" name="submit1149" value="Process 1149">
    </p>
  </form>
<script language="JavaScript">
<!-- // create calendar object(s) just after form tag closed
var cal1 = new calendar2(document.forms['submit1149'].elements['mtlreq']);
cal1.year_scroll = true;
cal1.time_comp = false;
var cal2 = new calendar2(document.forms['submit1149'].elements['shipdte']);
cal2.year_scroll = true;
cal2.time_comp = false;
var cal3 = new calendar2(document.forms['submit1149'].elements['invoicedate']);
cal3.year_scroll = true;
cal3.time_comp = false;
//-->
</script>
  <p> <br>
</div>
</body>
</html>[/code]
Link to comment
https://forums.phpfreaks.com/topic/34923-please-help-i-am-at-my-limit-here/
Share on other sites

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.