Jump to content

itgranny

Members
  • Posts

    20
  • Joined

  • Last visited

itgranny's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I have a mysql table where the columns are id, name, username and password. I have it working so that names are in the dropdown, its its posting it, but is there a way to make it display the name, yet post the id? The following is what I have done, it works, but the id is just a number and means nothing to the user. When I trade that out for name, the user is able to read and understand it, but some of the names have spaces, punctuation ect, and I would like to have it to be able to look up the username and password once the main table is to be updated. $sql = "SELECT * FROM stud ORDER BY studName"; $result = mysql_query($sql); echo "<td> <select name='id'>"; while ($row = mysql_fetch_array($result)) { echo "<option style='text-transform: uppercase;'" . $row['id'] . "'id='dropdown' >" . $row['id'] . "</option>"; } echo "</select></td></tr>"; echo "<tr><td><input id='submit' name='submit' type='submit' value='Submit'></td></tr></table> </form>"; basically what I want is this but I can't get this to work. $sql = "SELECT * FROM stud ORDER BY studName"; $result = mysql_query($sql); echo "<td> <select name='id'>"; while ($row = mysql_fetch_array($result)) { echo "<option style='text-transform: uppercase;'" . $row['id'] . "'id='dropdown' >" . $row['name'] . "</option>"; } echo "</select></td></tr>"; echo "<tr><td><input id='submit' name='submit' type='submit' value='Submit'></td></tr></table> </form>";
  2. So is it Ajax that you get the username right away from the form or are you saying I need to put an addional dropdown that they have to fill out?
  3. I have 2 tables. One with site names and usernames, the other with data that needs to be entered from a form. The form has a dropdown list of the site names for the user to fill out. What I would like is for the form to automatically get the username and place it in the data table also, automatically. ID siteName userName 1 Site 1 site1 2 Site 2 site2 3 Site3 site3 Form has dropdown is populated with siteName from the site table. User picks one (along with other data but that's working). Submit Posted to insert page Insert page sees the siteName I want it to go to into site table and look for whatever site they chose and figure out what the userName it insert it into the username place in the data table that the form is updating. How would I go about doing this? I've tried a bunch of different ways but keep getting errors.
  4. This is the form. I changed out the connection. <!DOCTYPE html> <html> <head> <title>Supervisor Form</title> <!-- to make text boxes pure numbers --> <SCRIPT language=Javascript> <!-- function isNumberKey(evt) { var charCode = (evt.which) ? evt.which : event.keyCode if (charCode > 31 && (charCode < 48 || charCode > 57)) return false; return true; } //--> </SCRIPT> <style> body {background-color:lightgrey} .normal { font-family: Tahoma, Arial, sans-serif; font-color: black; font-size: 12pt; text-align: left; } .title { font-family: Tahoma, Arial, sans-serif; font-color: black; font-size: 16pt; font-weight: bold; } .center { margin-left: auto; margin-right: auto; text-align: center; } table td { height: 30px; padding:5px; } </style> </head> <body> <div style="width:100%;"> <div class="center" style="width:800px"> <div style="background-color: white; margin-top: -8px; width: 100%;"> <!-- Top Part --> <form method="post" action="visitInsert.php"> <?php $userid = uniqid(rand(),true); ?> <input type="hidden" name="userid" value="<?php echo $userid; ?>"> <table width=100% border="1" style="border-collapse:collapse"> <tr> <td class="title" width= "170px" rowspan="2">RVF Site Evaluation<br> <img src="images/logo.png"> </td> <td class="normal" width="220px"> <b>Date of visit:</b> <select name="date" size="1"> <?php $month= date("m"); $day= date("d"); $year= date("Y"); for($i=0; $i<=15; $i++){ echo "<option value='"; echo date('m-d-y',mktime(0,0,0,$month,($day-$i),$year)); echo "'>"; echo date('m-d-y',mktime(0,0,0,$month,($day-$i),$year)); echo "</option>"; } ?> </select> </td> <td class="normal" width="200px"> <b>Site:</b> <?php mysql_connect('localhost', 'user', 'pass'); mysql_select_db('visit'); $sql = "SELECT site FROM sites ORDER BY site"; $result = mysql_query($sql); echo "<select name='site'>"; while ($row = mysql_fetch_array($result)) { echo "<option style='text-transform: uppercase;'" . $row['site'] . "' >" . $row['site'] . "</option>"; } echo "</select>"; ?> </td> </tr> <tr> <td class="normal"> <b><b>Supervisor:</b></b> <?php $sql = "SELECT name FROM serviceman ORDER BY name"; $result = mysql_query($sql); echo "<select name='name'>"; while ($row = mysql_fetch_array($result)) { echo "<option style='text-transform: uppercase; value='" . $row['name'] . "' >" . $row['name'] . "</option>"; } echo "</select>"; ?> </td> <td class="normal"> <b>Group ID:</b> <input style="text-transform: uppercase" type="text" name="groupID" > </td> </tr> <tr> <td class="normal"><b>Caretaker There?</b> <br>Yes <input id="caretaker" name="caretaker" type="radio" value="T"> No <input id="caretaker" name="caretaker" type="radio" value="F"> </td> <td class="normal" colspan="2"> <b>Reason for Visit</b><br> Count <input id="count" name="reason" type="radio" value="1"> Mark <input id="mark" name="reason" type="radio" value="2"> Production/Management <input id="production" name="reason" type="radio" value="3"> </td> </tr> </table> <br> <!-- Bottom Part --> <table width=100% border="1" class="normal" style="border-collapse:collapse"> <tr> <!-- listed criteria --> <td style="width:200px;"> </td> <td style="width:250px; text-align: center; "> <b >Evaluation </b> </td> <td style="width:350px; text-align: left; "> <b>Comments</b> </td> </tr> <tr class="topic"> <td colspan="5"> <b>Pig Care</b> </td> </tr> <tr class="topic"> <td style="text-align: right;"> Cough </td> <td > 0<input name="cough" type="radio" value="0"> 1<input name="cough" type="radio" value="1"> 2<input name="cough" type="radio" value="2"> 3<input name="cough" type="radio" value="3"> 4<input name="cough" type="radio" value="4"> </td> <td class="topic" rowspan="9"> <span > Comments: <textarea rows="24" cols="50" placeholder="Type pigcare comments here...." style=" border: none; " name="careComments"></textarea> </span> </td> </tr> <tr class="topic"> <td style="text-align: right;"> Looseness </td> <td> 0<input name="looseness" type="radio" value="0"> 1<input name="looseness" type="radio" value="1"> 2<input name="looseness" type="radio" value="2"> 3<input name="looseness" type="radio" value="3"> 4<input name="looseness" type="radio" value="4"> </td> </tr> <tr class="topic"> <td style="text-align: right;"> Sorting </td> <td> 0<input name="sorting" type="radio" value="0"> 2<input name="sorting" type="radio" value="2"> </td> </tr> <tr class="topic"> <td style="text-align: right;"> Treating Sick Animals </td> <td> 0<input name="treating" type="radio" value="0"> 2<input name="treating" type="radio" value="2"> </td> </tr> <tr class="topic"> <td style="text-align: right;"> Walking Pens </td> <td> 0<input name="walking" type="radio" value="0"> 2<input name="walking" type="radio" value="2"> </td> </tr> <tr class="topic"> <td style="text-align: right;"> Water Meds 1 </td> <td style="text-align: center;"> <?php $sql = "SELECT med FROM med"; $result = mysql_query($sql); echo "<select name='med1'>"; while ($row = mysql_fetch_array($result)) { echo "<option value='" . $row['med'] . "'>" . $row['med'] . "</option>"; } echo "</select>"; ?> </td> </tr> <tr class="topic"> <td style="text-align: right;"> Water Meds 2 </td> <td style="text-align: center;"> <?php $sql = "SELECT med FROM med"; $result = mysql_query($sql); echo "<select name='med2'>"; while ($row = mysql_fetch_array($result)) { echo "<option value='" . $row['med'] . "'>" . $row['med'] . "</option>"; } echo "</select>"; ?> </td> </tr> <tr class="topic"> <td style="text-align: right;"> Euthanasia </td> <td> 0<input name="euthanasia" type="radio" value="0"> 2<input name="euthanasia" type="radio" value="2"> </td> </tr> <tr class="topic"> <td style="text-align: right;"> Biosecurity </td> <td> 0<input name="biosecurity" type="radio" value="0"> 2<input name="biosecurity" type="radio" value="2"> </td> </tr> <tr class="topic"> <td colspan="5"> <b>Feed</b> </td> </tr> <tr class="topic"> <td style="text-align: right;"> All pigs have access to feed </td> <td> 0<input name="feed" type="radio" value="0"> 1<input name="feed" type="radio" value="1"> 2<input name="feed" type="radio" value="2"> 3<input name="feed" type="radio" value="3"> 4<input name="feed" type="radio" value="4"> </td> <td class="topic" rowspan="3"> <span > Comments: <textarea rows="9" cols="50" placeholder="Type feed comments here...." style=" border: none;" name="feedComments"></textarea> </span> </td> </tr> <tr class="topic"> <td style="text-align: right;"> Feeder adjustments are correct </td> <td> 0<input name="adjustments" type="radio" value="0"> 3<input name="adjustments" type="radio" value="3"> </td> </tr> <tr class="topic"> <td style="text-align: right;"> Feed tickets </td> <td> 0<input name="tickets" type="radio" value="0"> 1<input name="tickets" type="radio" value="1"> </td> </td> </tr> <tr class="topic"> <td colspan="5"> <b>Water</b> </td> </tr> <tr class="topic"> <td style="text-align: right;"> All pigs have access to water </td> <td> 0<input name="water" type="radio" value="0"> 1<input name="water" type="radio" value="1"> 2<input name="water" type="radio" value="2"> 3<input name="water" type="radio" value="3"> 4<input name="water" type="radio" value="4"> </td> <td class="topic" rowspan="3"> <span > Comments: <textarea rows="9" cols="50" placeholder="Type water comments here...." style=" border: none;" name="waterComments"></textarea> </span> </td> </tr> <tr class="topic"> <td style="text-align: right;"> Line/filters clean </td> <td> 0<input name="cleanwater" type="radio" value="0"> 2<input name="cleanwater" type="radio" value="2"> </td> </tr> <tr class="topic"> <td style="text-align: right;"> Water meter readings </td> <td> 0<input name="meter" type="radio" value="0"> 2<input name="meter" type="radio" value="2"> </td> </tr> <tr class="topic"> <td colspan="5"> <b>Ventilation</b> </td> </tr> <tr class="topic"> <td style="text-align: right;"> Pig comfort temperatures </td> <td> 0<input name="temps" type="radio" value="0"> 2<input name="temps" type="radio" value="2"> </td> <td class="topic" rowspan="8"> <span > Comments: <textarea rows="30" cols="50" placeholder="Type ventilation comments here...." style=" border: none;" name="ventilationComments"></textarea> </span> </td> </tr> <tr class="topic"> <td style="text-align: right;"> Pig comfort humidity </td> <td> 0<input name="humidity" type="radio" value="0"> 2<input name="humidity" type="radio" value="2"> </td> </tr> <tr class="topic"> <td style="text-align: right;"> Fans </td> <td> 0<input name="fans" type="radio" value="0"> 1<input name="fans" type="radio" value="2"> </td> </tr> <tr class="topic"> <td style="text-align: right;"> Curtains </td> <td> 0<input name="curtains" type="radio" value="0"> 1<input name="curtains" type="radio" value="1"> </td> </tr> <tr class="topic"> <td style="text-align: right;"> Inlets </td> <td> 0<input name="inlets" type="radio" value="0"> 1<input name="inlets" type="radio" value="1"> </td> </tr> <tr class="topic"> <td style="text-align: right;"> Hi-Low records </td> <td> 0<input name="hilo" type="radio" value="0"> 1<input name="hilo" type="radio" value="1"> </td> </tr> <tr class="topic"> <td style="text-align: right;"> Alarm settings </td> <td> 0<input name="alarm" type="radio" value="0"> 1<input name="alarm" type="radio" value="1"> </td> </tr> <tr class="topic"> <td style="text-align: right;"> Back up settings </td> <td> 0<input name="backup" type="radio" value="0"> 1<input name="backup" type="radio" value="1"> </td> </tr> <tr class="topic"> <td colspan="5"> <b>Records</b> </td> </tr> <tr class="topic"> <td style="text-align: right;"> Pit level </td> <td> 0<input name="pitLevel" type="radio" value="0"> 1<input name="pitLevel" type="radio" value="1"> </td> <td class="topic" rowspan="10"> <span > Comments: <textarea rows="36" cols="50" placeholder="Type records comments here...." style=" border: none;" name="recordsComments"></textarea> </span> </td> </tr> <tr class="topic"> <td style="text-align: right;"> Med records </td> <td> 0<input name="medRecords" type="radio" value="0"> 1<input name="medRecords" type="radio" value="1"> </td> </tr> <tr class="topic"> <td style="text-align: right;"> Rodent plan </td> <td> 0<input name="rodent" type="radio" value="0"> 1<input name="rodent" type="radio" value="1"> </td> </tr> <tr class="topic"> <td style="text-align: right;"> Alarm test </td> <td> 0<input name="testAlarm" type="radio" value="0"> 1<input name="testAlarm" type="radio" value="1"> </td> </tr> <tr class="topic"> <td style="text-align: right;"> LP level checked </td> <td> 0<input name="lp" type="radio" value="0"> 1<input name="lp" type="radio" value="1"> </td> </tr> <tr class="topic"> <td style="text-align: right;"> LP levels </td> <td> <INPUT id="txtChar" onkeypress="return isNumberKey(event)" type="text" name="lpLevels" style="width: 40px;" maxlength="2">% </td> </tr> <tr class="topic"> <td style="text-align: right;"> Generator fuel level </td> <td> 0<input name="genFuel" type="radio" value="0"> 1<input name="genFuel" type="radio" value="1"> </td> </tr> <tr class="topic"> <td style="text-align: right;"> Generator fuel </td> <td> <INPUT id="txtChar" onkeypress="return isNumberKey(event)" type="text" name="genFuelLevel" style="width: 40px;" maxlength="2">% </td> </tr> <tr class="topic"> <td style="text-align: right;"> Generator hours recorded </td> <td> 0<input name="genHoursRecord" type="radio" value="0"> 1<input name="genHoursRecord" type="radio" value="1"> </td> </tr> <tr class="topic"> <td style="text-align: right;"> Generator hours </td> <td> <INPUT id="txtChar" onkeypress="return isNumberKey(event)" type="text" name="genHours" style="width: 40px;" maxlength="7"> hours </td> </tr> <tr class="topic"> <td colspan="3"> <b>Inventory</b> </td> </tr> <tr> <td style="text-align: right;"> Inventory records </td> <td> 0<input name="invRecords" type="radio" value="0"> 1<input name="invRecords" type="radio" value="1"> </td> <td rowspan="5"> <span > Comments: <textarea rows="10" cols="50" placeholder="Type inventory notes here...." style=" border: none;" name="invNotes"></textarea> </span> </td> </tr> <tr> <td style="text-align: right;"> Current inv.</td> <td><INPUT id="txtChar" onkeypress="return isNumberKey(event)" type="text" name="currentInv" style="width: 40px;" maxlength="8"></td>; <tr> <td style="text-align: right;"> Starting inventory </td> <td> <INPUT id="txtChar" onkeypress="return isNumberKey(event)" type="text" name="start" style="width: 40px;" maxlength="8"> </td> </tr> <tr> <td style="text-align: right;"> Deads </td> <td> <INPUT id="txtChar" onkeypress="return isNumberKey(event)" type="text" name="deads" style="width: 40px;" maxlength="5"> </td> </tr> <tr class="topic"> <td colspan="3"> <b>Facility</b> </td> </tr> <tr class="topic"> <td style="text-align: right;"> Office clean </td> <td> 0<input name="cleanOffice" type="radio" value="0"> 2<input name="cleanOffice" type="radio" value="2"> </td> <td rowspan="6" style='vertical-align:top;'"> <span > Comments: <textarea rows="10" cols="50" placeholder="Typesite/facility comments here. (lighting, gates and flooring, chutes, dead disposal, etc.)" style=" border: none;" name="facilityComments"></textarea> </span> </td> </tr> <tr class="topic"> <td style="text-align: right;"> Mowing/Outside </td> <td> 0<input name="mow" type="radio" value="0"> 2<input name="mow" type="radio" value="2"> </td> <tr class="topic"> <td style="text-align: right;"> Chute </td> <td> 0<input name="chute" type="radio" value="0"> 2<input name="chute" type="radio" value="2"> </td> </tr> <tr class="topic"> <td style="text-align: right;"> Gates </td> <td> 0<input name="gates" type="radio" value="0"> 2<input name="gates" type="radio" value="2"> </td> </tr> <tr class="topic"> <td style="text-align: right;"> Lights </td> <td> 0<input name="lights" type="radio" value="0"> 2<input name="lights" type="radio" value="2"> </td> </tr> <tr class="topic"> <td style="text-align: right;"> Dead disposal </td> <td> 0<input name="deadDisp" type="radio" value="0"> 2<input name="deadDisp" type="radio" value="2"> </td> </tr> <tr class="topic"> <td colspan="3"> <b>Summary/Goals</b> </td> </tr> <td colspan="3" <span > <textarea rows="5" cols="93" placeholder="Visit notes (communications and followups)" style=" border: none;" name="summaryComments"></textarea> </span> </td> </tr> <tr> <td colspan="3"><input type="submit" name="submit" value="submit"> </td> </tr> </table> </form> <br><br><br><br><br> </div> </div> </div> </body> </html> This is the actual reciever. Its the bottom lines. I've tried them several ways. None work. <?php $con=mysqli_connect('localhost', 'user', 'pass', "visit"); // Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } $today = date("F j, Y, g:i a"); $careComments = htmlspecialchars("$_POST[careComments]", ENT_QUOTES); $feedComments = htmlspecialchars("$_POST[feedComments]", ENT_QUOTES); $waterComments = htmlspecialchars("$_POST[waterComments]", ENT_QUOTES); $ventilationComments = htmlspecialchars("$_POST[ventilationComments]", ENT_QUOTES); $recordsComments = htmlspecialchars("$_POST[recordsComments]", ENT_QUOTES); $invNotes = htmlspecialchars("$_POST[invNotes]", ENT_QUOTES); $facilityComments = htmlspecialchars("$_POST[facilityComments]", ENT_QUOTES); $summaryComments = htmlspecialchars("$_POST[summaryComments]", ENT_QUOTES); $deads = "$_POST[deads]"; $start = "$_POST[start]"; $mortality = $deads/$start*100; $userid = "$_POST[userid]"; $sql="INSERT INTO visitNotes (id,today,userid,date,site,name,groupID,caretaker,reason,careComments,cough,looseness,sorting,treating,walking,med1,med2,euthanasia,biosecurity,feed,feedComments,adjustments,tickets,water,waterComments,cleanwater,meter,temps,ventilationComments,humidity,fans,curtains,inlets,hilo,alarm,backup,pitLevel,recordsComments,medRecords,rodent,testAlarm,lp,lpLevels,genFuel,genFuelLevel,genHoursRecord,genHours,invRecords,invNotes,currentInv,start,deads,mortality,cleanOffice,facilityComments,mow,gates,chute,lights,deadDisp,summaryComments) VALUES ('$_POST[id]','$today','$_POST[userid]','$_POST[date]','$_POST[site]','$_POST[name]','$_POST[groupID]','$_POST[caretaker]','$_POST[reason]','$careComments','$_POST[cough]','$_POST[looseness]','$_POST[sorting]','$_POST[treating]','$_POST[walking]','$_POST[med1]','$_POST[med2]','$_POST[euthanasia]','$_POST[biosecurity]','$_POST[feed]','$feedComments','$_POST[adjustments]','$_POST[tickets]','$_POST[water]','$waterComments','$_POST[cleanwater]','$_POST[meter]','$_POST[temps]','$ventilationComments','$_POST[humidity]','$_POST[fans]','$_POST[curtains]','$_POST[inlets]','$_POST[hilo]','$_POST[alarm]','$_POST[backup]','$_POST[pitLevel]','$recordsComments','$_POST[medRecords]','$_POST[rodent]','$_POST[testAlarm]','$_POST[lp]','$_POST[lpLevels]','$_POST[genFuel]','$_POST[genFuelLevel]','$_POST[genHoursRecord]','$_POST[genHours]','$_POST[invRecords]','$invNotes','$_POST[currentInv]','$_POST[start]','$_POST[deads]','$mortality','$_POST[cleanOffice]','$facilityComments','$_POST[mow]','$_POST[gates]','$_POST[chute]','$_POST[lights]','$_POST[deadDisp]','$summaryComments')"; if (!mysqli_query($con,$sql)) { die('Error: ' . mysqli_error($con)); } echo "1 record added <br>"; echo "<a href='visitDetails.php?userid='$_POST[userid]'>Email Visit Results</a>"; echo "<br><br><a href='visitDetails.php?userid='" . $userid . "'>Visit Results</a>"; mysqli_close($con); ?>
  5. On the form page, I have this code to get the userid. The whole userid thing is so nobody can guess what the url is. <?php $userid = uniqid(rand(),true); ?> Then it gets posted to this page along with my other form items. The only thing that's not here is the connection which is just a mysqli string. I'm just not sure why it can remember it to put it in the database, but forgets it in that last line.
  6. Yeah, that's what's happening but why? It goes into the database just fine in the code earlier. Why can't it remember it either as coming from a POST or even a variable?
  7. I am having trouble with having my page remember a POST item. What I'm trying to do is to have the data updated message to include a link using a userid, a random number that's used to find things in the database. I've tried several ways but still having trouble. Below are 2 such ways (along with others). I keep getting a page where the userid doesn't show up. It doesn't make sense though because it gets inserted into the database. Could someone take a look? Instead of coming up with a link like this: http://www.mynewpage.com/visitdetails.php?userid=113555588701606e973.42256784 It looks like this and I get a page doesn't exist error. http://www.mynewpage.com/visitDetails.php?userid= connection info here..... $today = date("F j, Y, g:i a"); $careComments = htmlspecialchars("$_POST[careComments]", ENT_QUOTES); $feedComments = htmlspecialchars("$_POST[feedComments]", ENT_QUOTES); $waterComments = htmlspecialchars("$_POST[waterComments]", ENT_QUOTES); $ventilationComments = htmlspecialchars("$_POST[ventilationComments]", ENT_QUOTES); $recordsComments = htmlspecialchars("$_POST[recordsComments]", ENT_QUOTES); $invNotes = htmlspecialchars("$_POST[invNotes]", ENT_QUOTES); $facilityComments = htmlspecialchars("$_POST[facilityComments]", ENT_QUOTES); $summaryComments = htmlspecialchars("$_POST[summaryComments]", ENT_QUOTES); $deads = "$_POST[deads]"; $start = "$_POST[start]"; $mortality = $deads/$start*100; $userid = "$_POST[userid]"; $sql="INSERT INTO visitNotes (id,today,userid,date,site,name,groupID,caretaker,reason,careComments,cough,looseness,sorting,treating,walking,med1,med2,euthanasia,biosecurity,feed,feedComments,adjustments,tickets,water,waterComments,cleanwater,meter,temps,ventilationComments,humidity,fans,curtains,inlets,hilo,alarm,backup,pitLevel,recordsComments,medRecords,rodent,testAlarm,lp,lpLevels,genFuel,genFuelLevel,genHoursRecord,genHours,invRecords,invNotes,currentInv,start,deads,mortality,cleanOffice,facilityComments,mow,gates,chute,lights,deadDisp,summaryComments) VALUES ('$_POST[id]','$today','$_POST[userid]','$_POST[date]','$_POST[site]','$_POST[name]','$_POST[groupID]','$_POST[caretaker]','$_POST[reason]','$careComments','$_POST[cough]','$_POST[looseness]','$_POST[sorting]','$_POST[treating]','$_POST[walking]','$_POST[med1]','$_POST[med2]','$_POST[euthanasia]','$_POST[biosecurity]','$_POST[feed]','$feedComments','$_POST[adjustments]','$_POST[tickets]','$_POST[water]','$waterComments','$_POST[cleanwater]','$_POST[meter]','$_POST[temps]','$ventilationComments','$_POST[humidity]','$_POST[fans]','$_POST[curtains]','$_POST[inlets]','$_POST[hilo]','$_POST[alarm]','$_POST[backup]','$_POST[pitLevel]','$recordsComments','$_POST[medRecords]','$_POST[rodent]','$_POST[testAlarm]','$_POST[lp]','$_POST[lpLevels]','$_POST[genFuel]','$_POST[genFuelLevel]','$_POST[genHoursRecord]','$_POST[genHours]','$_POST[invRecords]','$invNotes','$_POST[currentInv]','$_POST[start]','$_POST[deads]','$mortality','$_POST[cleanOffice]','$facilityComments','$_POST[mow]','$_POST[gates]','$_POST[chute]','$_POST[lights]','$_POST[deadDisp]','$summaryComments')"; if (!mysqli_query($con,$sql)) { die('Error: ' . mysqli_error($con)); } echo "1 record added <br>"; echo "<a href='visitDetails.php?userid='$_POST[userid]'>Email Visit Results</a>"; echo "<br><br><a href='visitDetails.php?userid='" . $userid . "'>Visit Results</a>"; mysqli_close($con); ?>
  8. Unfortunately my ideas out pace my skills. I have a database that I would like certain people to access their own info, but nobody else's. It's not super sensitive info and won't mean much to anyone other than the end user but we don't like the idea of others accessing it so we'd like to put some protection on it. What I was hoping for is a dropdown list (there's about 30 or so clients that would be in a mysql table) where they can pick out their name, then text box for the password. When they hit submit button it would lead them to their own page with a table and their own info from a mysql table. I can get each one of these details to work separately, but I'm having trouble putting them all together (the password is where things get muddled). Can anyone point me to a place where they've already figured this out? Thanks!
  9. OK, thanks, I absent mindedly deleted the original file and this was put together quickly. Can that array be put together on the fly so that it gets constructed by whatever's in the database? That way, when more fan information comes in, (example a 12 inch fan or a 60 inch fan) They can be plugged into the db and the calculator will update automatically. Thanks for your help!
  10. Thank you. I was looking for that button but couldn't figure out what it was.
  11. I couldn't find how to upload files (if its even possible) so i have csv files to show what the database looks like. even just telling me what I need to be looking for would be fine. I have no idea what this stuff is called. Http://thelambpatch.com/fan.csv http://thelambpatch.com/cfm.csv Thanks!
  12. Ok, so I'm back to the fans. thanks everyone for looking at this. I'm thinking my biggest problem is not understanding loops and arrays and how to make them work with mysql. So here's what I got. http://www.swinevetcenter.com/tools/ventinput1.php Its not done and I'm seeing a few tweeks I need to make but I actually want the layout of both pages to look similar to this. A table with a series of dropdowns where users choose the number of each particular fan size and it adds things up. Here's the code I have. As you can see, it works, but it seems pretty long and redundant and I was thinking it could be shortened quite a lot with loops. Input page: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"> <html> <head> <title>Ventilation Calculator Input</title> <meta id="meta" name="viewport" content="width=device-width; initial-scale=1.0"> <style type="text/css"> div { font-family: "tahoma"; font-weight: "bold"; font-size: "24pt" } table { text-align: center; } table { border: 1px solid black; border-collapse: collapse; } td { border: 1px solid black; } .right { text-align: right; } .left { text-align: left; } </style> <script language="JavaScript" type="text/javascript"> function validate(evt) { var theEvent = evt || window.event; var key = theEvent.keyCode || theEvent.which; key = String.fromCharCode( key ); var regex = /[0-9]|\./; if( !regex.test(key) ) { theEvent.returnValue = false; if(theEvent.preventDefault) theEvent.preventDefault(); } } </script> </head> <body> <div> <form id="form" name="form" action="http://www.swinevetcenter.com/tools/ventresults.php" method="post"> <b><h1>Ventilation Calculator</h1></b> <!--start of number of pigs form..........................................................--> <b><span >Pig Info:</span></b><br /> Number of pigs in the barn:<br> <input id="pigNumber" name="pigNumber" type="text" size="10" onkeypress='validate(event)'> <!--end of number of pigs form..........................................................--> <!--start of pig weight form..........................................................--> <br> <br> <?php mysql_connect('db', 'un', 'pw'); mysql_select_db('un'); $sql = "SELECT weight FROM cfm ORDER BY weight"; $result = mysql_query($sql); echo "<p><b>Pig Weight</b><br>"; echo "<select weight='weight' name='weight' id='weight'>"; while ($row = mysql_fetch_array($result)) { echo "<option value='" . $row['weight'] . "'>" . $row['weight'] . "</option>"; } echo "</select>"; ?> <br> <br> <!--end of pig weight form..........................................................--> <!--start of minimun ventilation form..........................................................--> <b>Fan Info</b> <table> <tr> <td colspan="11" class="left"><b>Select Size and Number of Stage 1 Fans</b></td> </tr> <tr> <td class="right">Fan Size</td> <td >9"</td> <td >10"</td> <td >14"</td> <td >16"</td> <td >18"</td> <td >20"</td> <td >24"</td> <td >36"</td> <td >48"</td> <td >50"</td> <td >52"</td> <td >54"</td> </tr> <tr> <td class="right">Number of Stage 1 Fans</td> <td ><select name="9inmin" size="0"> <option value="0" selected> 0 </option> <option value="1"> 1 </option> <option value="2"> 2 </option> <option value="3"> 3 </option> <option value="4"> 4 </option> <option value="5"> 5 </option> <option value="6"> 6 </option> <option value="7"> 7 </option> <option value="8"> 8 </option> <option value="9"> 9 </option> <option value="10"> 10 </option> </select></td> <td ><select name="10inmin" size="0"> <option value="0" selected> 0 </option> <option value="1"> 1 </option> <option value="2"> 2 </option> <option value="3"> 3 </option> <option value="4"> 4 </option> <option value="5"> 5 </option> <option value="6"> 6 </option> <option value="7"> 7 </option> <option value="8"> 8 </option> <option value="9"> 9 </option> <option value="10"> 10 </option> </select></td> <td ><select name="14inmin" size="0"> <option value="0" selected> 0 </option> <option value="1"> 1 </option> <option value="2"> 2 </option> <option value="3"> 3 </option> <option value="4"> 4 </option> <option value="5"> 5 </option> <option value="6"> 6 </option> <option value="7"> 7 </option> <option value="8"> 8 </option> <option value="9"> 9 </option> <option value="10"> 10 </option> </select></td> <td ><select name="16inmin" size="0"> <option value="0" selected> 0 </option> <option value="1"> 1 </option> <option value="2"> 2 </option> <option value="3"> 3 </option> <option value="4"> 4 </option> <option value="5"> 5 </option> <option value="6"> 6 </option> <option value="7"> 7 </option> <option value="8"> 8 </option> <option value="9"> 9 </option> <option value="10"> 10 </option> </select></td> <td ><select name="18inmin" size="0"> <option value="0" selected> 0 </option> <option value="1"> 1 </option> <option value="2"> 2 </option> <option value="3"> 3 </option> <option value="4"> 4 </option> <option value="5"> 5 </option> <option value="6"> 6 </option> <option value="7"> 7 </option> <option value="8"> 8 </option> <option value="9"> 9 </option> <option value="10"> 10 </option> </select></td> <td ><select name="20inmin" size="0"> <option value="0" selected> 0 </option> <option value="1"> 1 </option> <option value="2"> 2 </option> <option value="3"> 3 </option> <option value="4"> 4 </option> <option value="5"> 5 </option> <option value="6"> 6 </option> <option value="7"> 7 </option> <option value="8"> 8 </option> <option value="9"> 9 </option> <option value="10"> 10 </option> </select></td> <td ><select name="24inmin" size="0"> <option value="0" selected> 0 </option> <option value="1"> 1 </option> <option value="2"> 2 </option> <option value="3"> 3 </option> <option value="4"> 4 </option> <option value="5"> 5 </option> <option value="6"> 6 </option> <option value="7"> 7 </option> <option value="8"> 8 </option> <option value="9"> 9 </option> <option value="10"> 10 </option> </select></td> <td ><select name="36inmin" size="0"> <option value="0" selected> 0 </option> <option value="1"> 1 </option> <option value="2"> 2 </option> <option value="3"> 3 </option> <option value="4"> 4 </option> <option value="5"> 5 </option> <option value="6"> 6 </option> <option value="7"> 7 </option> <option value="8"> 8 </option> <option value="9"> 9 </option> <option value="10"> 10 </option> </select></td> <td ><select name="48inmin" size="0"> <option value="0" selected> 0 </option> <option value="1"> 1 </option> <option value="2"> 2 </option> <option value="3"> 3 </option> <option value="4"> 4 </option> <option value="5"> 5 </option> <option value="6"> 6 </option> <option value="7"> 7 </option> <option value="8"> 8 </option> <option value="9"> 9 </option> <option value="10"> 10 </option> </select></td> <td ><select name="50inmin" size="0"> <option value="0" selected> 0 </option> <option value="1"> 1 </option> <option value="2"> 2 </option> <option value="3"> 3 </option> <option value="4"> 4 </option> <option value="5"> 5 </option> <option value="6"> 6 </option> <option value="7"> 7 </option> <option value="8"> 8 </option> <option value="9"> 9 </option> <option value="10"> 10 </option> </select></td> <td ><select name="52inmin" size="0"> <option value="0" selected> 0 </option> <option value="1"> 1 </option> <option value="2"> 2 </option> <option value="3"> 3 </option> <option value="4"> 4 </option> <option value="5"> 5 </option> <option value="6"> 6 </option> <option value="7"> 7 </option> <option value="8"> 8 </option> <option value="9"> 9 </option> <option value="10"> 10 </option> </select></td> <td ><select name="54inmin" size="0"> <option value="0" selected> 0 </option> <option value="1"> 1 </option> <option value="2"> 2 </option> <option value="3"> 3 </option> <option value="4"> 4 </option> <option value="5"> 5 </option> <option value="6"> 6 </option> <option value="7"> 7 </option> <option value="8"> 8 </option> <option value="9"> 9 </option> <option value="10"> 10 </option> </select></td> </tr> </table> <!--end of minimun ventilation form..........................................................--> <br /><br /> <!--start of minimun ventilation form..........................................................--> <table> <tr> <td colspan="11" class="left"><b>Select Size and Number of Barn Fans</b></td> </tr> <tr></tr> <td class="right">Fan Size</td> <td >9"</td> <td >10"</td> <td >18"</td> <td >20"</td> <td >24"</td> <td >36"</td> <td >48"</td> <td >50"</td> <td >52"</td> <td >54"</td> </tr> <tr> <td class="right">Number of Barn Fans</td> <td ><select name="9in" size="0"> <option value="0" selected> 0 </option> <option value="1"> 1 </option> <option value="2"> 2 </option> <option value="3"> 3 </option> <option value="4"> 4 </option> <option value="5"> 5 </option> <option value="6"> 6 </option> <option value="7"> 7 </option> <option value="8"> 8 </option> <option value="9"> 9 </option> <option value="10"> 10 </option> </select></td> <td ><select name="10in" size="0"> <option value="0" selected> 0 </option> <option value="1"> 1 </option> <option value="2"> 2 </option> <option value="3"> 3 </option> <option value="4"> 4 </option> <option value="5"> 5 </option> <option value="6"> 6 </option> <option value="7"> 7 </option> <option value="8"> 8 </option> <option value="9"> 9 </option> <option value="10"> 10 </option> </select></td> <td ><select name="18in" size="0"> <option value="0" selected> 0 </option> <option value="1"> 1 </option> <option value="2"> 2 </option> <option value="3"> 3 </option> <option value="4"> 4 </option> <option value="5"> 5 </option> <option value="6"> 6 </option> <option value="7"> 7 </option> <option value="8"> 8 </option> <option value="9"> 9 </option> <option value="10"> 10 </option> </select></td> <td ><select name="20in" size="0"> <option value="0" selected> 0 </option> <option value="1"> 1 </option> <option value="2"> 2 </option> <option value="3"> 3 </option> <option value="4"> 4 </option> <option value="5"> 5 </option> <option value="6"> 6 </option> <option value="7"> 7 </option> <option value="8"> 8 </option> <option value="9"> 9 </option> <option value="10"> 10 </option> </select></td> <td ><select name="24in" size="0"> <option value="0" selected> 0 </option> <option value="1"> 1 </option> <option value="2"> 2 </option> <option value="3"> 3 </option> <option value="4"> 4 </option> <option value="5"> 5 </option> <option value="6"> 6 </option> <option value="7"> 7 </option> <option value="8"> 8 </option> <option value="9"> 9 </option> <option value="10"> 10 </option> </select></td> <td ><select name="36in" size="0"> <option value="0" selected> 0 </option> <option value="1"> 1 </option> <option value="2"> 2 </option> <option value="3"> 3 </option> <option value="4"> 4 </option> <option value="5"> 5 </option> <option value="6"> 6 </option> <option value="7"> 7 </option> <option value="8"> 8 </option> <option value="9"> 9 </option> <option value="10"> 10 </option> </select></td> <td ><select name="48in" size="0"> <option value="0" selected> 0 </option> <option value="1"> 1 </option> <option value="2"> 2 </option> <option value="3"> 3 </option> <option value="4"> 4 </option> <option value="5"> 5 </option> <option value="6"> 6 </option> <option value="7"> 7 </option> <option value="8"> 8 </option> <option value="9"> 9 </option> <option value="10"> 10 </option> </select></td> <td ><select name="50in" size="0"> <option value="0" selected> 0 </option> <option value="1"> 1 </option> <option value="2"> 2 </option> <option value="3"> 3 </option> <option value="4"> 4 </option> <option value="5"> 5 </option> <option value="6"> 6 </option> <option value="7"> 7 </option> <option value="8"> 8 </option> <option value="9"> 9 </option> <option value="10"> 10 </option> </select></td> <td ><select name="52in" size="0"> <option value="0" selected> 0 </option> <option value="1"> 1 </option> <option value="2"> 2 </option> <option value="3"> 3 </option> <option value="4"> 4 </option> <option value="5"> 5 </option> <option value="6"> 6 </option> <option value="7"> 7 </option> <option value="8"> 8 </option> <option value="9"> 9 </option> <option value="10"> 10 </option> </select></td> <td ><select name="54in" size="0"> <option value="0" selected> 0 </option> <option value="1"> 1 </option> <option value="2"> 2 </option> <option value="3"> 3 </option> <option value="4"> 4 </option> <option value="5"> 5 </option> <option value="6"> 6 </option> <option value="7"> 7 </option> <option value="8"> 8 </option> <option value="9"> 9 </option> <option value="10"> 10 </option> </select></td> </tr> </table> <br /> <br /> <br /> <input id="submit" name="submit" type="submit" value="Submit" method="post"> </form> </div> </body> </html> ------------------------------------------------------------------------------------------------------------------------------- the results page: <!DOCTYPE html> <html> <head> <title>Ventilation Calculator Results</title> <style type="text/css"> <!-- body { font-family: Tahoma, Arial, sans-serif; font-size: 18px; } .headline { font-weight: bold; font-size: 22pt; } .alignR { text-align: right; } .alignL { text-align:left; } .alignM { text-align: center; } </style> <style type="text/css"> table.c2 {border-collapse:collapse;} tr.c1 {text-align: center;} </style> </head> <body> <?php $pigNumber = $_POST['pigNumber']; $weight = $_POST['weight']; //open database connection $link = mysql_connect("db", "un", "pw"); mysql_select_db("un", $link); //--------------------------------------------------- //cfm's per pig for pig size //data pulled from the cfm table; $results = mysql_query("SELECT * FROM cfm WHERE weight=$weight", $link); while ($row = mysql_fetch_array($results)) { $cfmperpig = $row['cfm']; }; //data pulled from the fan table. //currently I have it going in over and over to pull relevant information //what I need is a way for it to go in, get the full table's worth of information //variables needed: //$fansize (for the inches) //$fanspeed (for cfm) //--------------------------------------------------------- //9" fan $results = mysql_query("SELECT * FROM fan WHERE size=9", $link); while ($row = mysql_fetch_array($results)) { $capacity9 = $row['capacity']; }; //--------------------------------------------------------- //10" fan $results = mysql_query("SELECT * FROM fan WHERE size=10", $link); while ($row = mysql_fetch_array($results)) { $capacity10 = $row['capacity']; }; //--------------------------------------------------------- //14" fan $results = mysql_query("SELECT * FROM fan WHERE size=14", $link); while ($row = mysql_fetch_array($results)) { $capacity14 = $row['capacity']; }; //--------------------------------------------------------- //16" fan $results = mysql_query("SELECT * FROM fan WHERE size=16", $link); while ($row = mysql_fetch_array($results)) { $capacity16 = $row['capacity']; }; //--------------------------------------------------------- //18" fan $results = mysql_query("SELECT * FROM fan WHERE size=18", $link); while ($row = mysql_fetch_array($results)) { $capacity18 = $row['capacity']; } //--------------------------------------------------------- //20" fan $results = mysql_query("SELECT * FROM fan WHERE size=20", $link); while ($row = mysql_fetch_array($results)) { $capacity20 = $row['capacity']; }; //--------------------------------------------------------- //24" fan $results = mysql_query("SELECT * FROM fan WHERE size=24", $link); while ($row = mysql_fetch_array($results)) { $capacity24 = $row['capacity']; }; //--------------------------------------------------------- //36" fan $results = mysql_query("SELECT * FROM fan WHERE size=36", $link); while ($row = mysql_fetch_array($results)) { $capacity36 = $row['capacity']; }; //--------------------------------------------------------- //48" fan $results = mysql_query("SELECT * FROM fan WHERE size=48", $link); while ($row = mysql_fetch_array($results)) { $capacity48 = $row['capacity']; }; //--------------------------------------------------------- //50" fan $results = mysql_query("SELECT * FROM fan WHERE size=50", $link); while ($row = mysql_fetch_array($results)) { $capacity50 = $row['capacity']; }; //--------------------------------------------------------- //52" fan $results = mysql_query("SELECT * FROM fan WHERE size=52", $link); while ($row = mysql_fetch_array($results)) { $capacity52 = $row['capacity']; }; //--------------------------------------------------------- //54" fan $results = mysql_query("SELECT * FROM fan WHERE size=54", $link); while ($row = mysql_fetch_array($results)) { $capacity54 = $row['capacity']; }; $output9 = $capacity9*$fan9in; $output10 = $capacity10*$fan10in; $output14 = $capacity14*$fan14in; $output16 = $capacity16*$fan16in; $output18 = $capacity18*$fan18in; $output20 = $capacity20*$fan20in; $output24 = $capacity24*$fan24in; $output36 = $capacity36*$fan36in; $output48 = $capacity48*$fan48in; $output50 = $capacity50*$fan50in; $output52 = $capacity52*$fan52in; $output54 = $capacity54*$fan54in; $minout9 = $capacity9*$minvent9; $minout10 = $capacity10*$minvent10; $minout14 = $capacity14*$minvent14; $minout16 = $capacity16*$minvent16; $minout18 = $capacity18*$minvent18; $minout20 = $capacity20*$minvent20; $minout24 = $capacity24*$minvent24; $neededcfms = $cfmperpig*$pigNumber; ?><b>Ventilation Worksheet Results</b><br> <br> <br> <b class="c1">Pig Info</b><br> Number of pigs: <?php echo $pigNumber ?><br> Weight of pigs: <?php echo $weight ?><br> cfm's needed per pig: <?php echo $cfmperpig ?><br> cfm's needed for barn: <?php echo $neededcfms;?><br> <br> <br> <br> <b>Fan Information</b><br> <!--would like to get the fan list straight from the database and have them as individual variables; That way fan sizes could be added to the database and it would just update easily by itself.--> <br> <table border="1" class="c2"> <tr class="c1"> <td colspan="14">Fan Information by Size</td> </tr> <tr> <td>Fan Size</td> <td>9"</td> <td>10"</td> <td>14"</td> <td>16"</td> <td>18"</td> <td>20"</td> <td>24"</td> <td>36"</td> <td>48"</td> <td>50"</td> <td>52"</td> <td>54"</td> <td colspan="2"></td> </tr> <tr> <td>cfm's</td> <td><?php echo $capacity9 ?></td> <td><?php echo $capacity10 ?></td> <td><?php echo $capacity14 ?></td> <td><?php echo $capacity16 ?></td> <td><?php echo $capacity18 ?></td> <td><?php echo $capacity20 ?></td> <td><?php echo $capacity24 ?></td> <td><?php echo $capacity36 ?></td> <td><?php echo $capacity48 ?></td> <td><?php echo $capacity50 ?></td> <td><?php echo $capacity52 ?></td> <td><?php echo $capacity54 ?></td> </tr> <tr> <td colspan="14">Stage 1 Fans</td> </tr> <tr> <td>Number of Stage 1 Fans</td> <td><?php echo $_POST['9inmin'] ?></td> <td><?php echo $_POST['10inmin'] ?></td> <td><?php echo $_POST['14inmin'] ?></td> <td><?php echo $_POST['16inmin'] ?></td> <td><?php echo $_POST['18inmin'] ?></td> <td><?php echo $_POST['20inmin'] ?></td> <td><?php echo $_POST['24inmin'] ?></td> <td><?php echo $_POST['36inmin'] ?></td> <td><?php echo $_POST['48inmin'] ?></td> <td><?php echo $_POST['50inmin'] ?></td> <td><?php echo $_POST['52inmin'] ?></td> <td><?php echo $_POST['54inmin'] ?></td> <td>Total Stage 1 cfm's</td> </tr> <tr> <td>cfm's</td> <td><?php echo $capacity9*$_POST['9inmin'] ?></td> <td><?php echo $capacity10*$_POST['10inmin'] ?></td> <td><?php echo $capacity14*$_POST['14inmin'] ?></td> <td><?php echo $capacity16*$_POST['16inmin'] ?></td> <td><?php echo $capacity18*$_POST['18inmin'] ?></td> <td><?php echo $capacity20*$_POST['20inmin'] ?></td> <td><?php echo $capacity24*$_POST['24inmin'] ?></td> <td><?php echo $capacity36*$_POST['36inmin'] ?></td> <td><?php echo $capacity48*$_POST['48inmin'] ?></td> <td><?php echo $capacity50*$_POST['50inmin'] ?></td> <td><?php echo $capacity52*$_POST['52inmin'] ?></td> <td><?php echo $capacity54*$_POST['54inmin'] ?></td> <td> <?php echo ($capacity9*$_POST['9inmin'])+($capacity10*$_POST['10inmin'])+($capacity14*$_POST['14inmin'])+($capacity16*$_POST['16inmin'])+($capacity18*$_POST['18inmin'])+($capacity20*$_POST['20inmin'])+($capacity24*$_POST['24inmin'])+($capacity36*$_POST['36inmin'])+($capacity48*$_POST['48inmin'])+($capacity50*$_POST['50inmin'])+($capacity52*$_POST['52inmin'])+($capacity54*$_POST['54inmin']); ?> </td> </tr> </table> </body> </html> it just seems like it could be made so much simpler with loops.
  13. Im not sure I'm understanding this. I'd like to list all of the fan sizes and the cubic feet per minute of each and multiply that by the cfm's (cubic feet per minute of air blown). The end result would be a table with each fan size listed, how many cfm's a single fan of that size would move and finally the number of each size of fan times the single fan's cfm's for a total. so, basically, it would go to the database for 2 things, the fan size and the cfm's. Right now I have information on about 6-8 fan sizes, but I'd like to add to that at some point. this may sound strange but I want to tell the database open connection Go to the fan info table build a table first row: list all the fan sizes second row: match with all the cfm's for each size third row: list the number of each fan that was selected in the previous page (which was a dropdown built with the database fan sizes) fourth row: multiply the second row by the third for the total cfm's of any particular fan. This last line would also be totaled in the end. So each fan size would have two variables, its name and its output. Clear as mud huh?
  14. I'm not sure I know how to explain what I want to allow you to understand. I'm working on a ventilation app that has different fan sizes. In the input php file I have a dropdown list that's populated by what's in the database. I'd like a results page that lists the fan size and number of each size and the cfm's each fan kicks out. the problem is that I don't know how to do anything with it other than hard code it. What I'd like, is for it to also pull all of the fan sizes and list them, that way the database can be fluid. This is the code I'd like to replace with some sort of loop. //9" fan $results = mysql_query("SELECT * FROM fan WHERE size=9", $link); while ($row = mysql_fetch_array($results)) { $capacity9 = $row['capacity']; }; //--------------------------------------------------------- //10" fan $results = mysql_query("SELECT * FROM fan WHERE size=10", $link); while ($row = mysql_fetch_array($results)) { $capacity10 = $row['capacity']; }; //--------------------------------------------------------- //14" fan $results = mysql_query("SELECT * FROM fan WHERE size=14", $link); while ($row = mysql_fetch_array($results)) { $capacity14 = $row['capacity']; }; //--------------------------------------------------------- //16" fan $results = mysql_query("SELECT * FROM fan WHERE size=16", $link); while ($row = mysql_fetch_array($results)) { $capacity16 = $row['capacity']; }; //--------------------------------------------------------- //18" fan $results = mysql_query("SELECT * FROM fan WHERE size=18", $link); while ($row = mysql_fetch_array($results)) { $capacity18 = $row['capacity']; } //--------------------------------------------------------- //20" fan $results = mysql_query("SELECT * FROM fan WHERE size=20", $link); while ($row = mysql_fetch_array($results)) { $capacity20 = $row['capacity']; }; //--------------------------------------------------------- //24" fan $results = mysql_query("SELECT * FROM fan WHERE size=24", $link); while ($row = mysql_fetch_array($results)) { $capacity24 = $row['capacity']; }; //--------------------------------------------------------- //36" fan $results = mysql_query("SELECT * FROM fan WHERE size=36", $link); while ($row = mysql_fetch_array($results)) { $capacity36 = $row['capacity']; };
  15. I'm sure the answer to this is out there but I have no idea what to call it. I've been googling most of the day trying to figure out different solutions. I have a supervisor visit form where I had been just time stamping with the current date. There's been times when the supervisor doesn't fill it out until the next day and I've got to figure out how to put a date in. It doesn't need to be a date that needs to be worked with I just want it to get put into the mysql table in anyway I can get it. What I've done is I've set up some dropdown forms they can put the date in. Now I'm trying to get the database to update. When I echo $visitDate, it displays it properly but it won't insert it correctly into the database. I've tried all sorts of things but none work. - seems to make it subtract, / makes it divide. I've tried making the mysql visitDate text and varchar but it still does math. $visitDate=$_POST[month] . "/" . $_POST[day] . "/" . $_POST[year]; Can someone spot what I'm doing wrong? thanks!
×
×
  • 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.