Jump to content

ncurran217

Members
  • Posts

    83
  • Joined

  • Last visited

Everything posted by ncurran217

  1. Sorry I copied the information up top, here it is with all the changes everyone suggested.: $result = sqlsrv_query($connection,$query); if(!$result) { die('We have no result so everything after will fail'); } // Move the data to a simple array to simplify presentation code. $resultAsArray = array(); while ( $row = sqlsrv_fetch( $result, SQLSRV_FETCH_ASSOC )) { $resultAsArray []= $row; } /*echo $resultAsArray;*/ ?> <form method="get" action="getlog.php"> <table width="250" border="0"> <tr> <td>Forte ID:</td> <td> <select name="test" id="test"> <?php foreach ($resultAsArray as $row): ?> <option name="Forte_ID" id="Forte_ID" value="<?php echo $row[ForteID];?>"><?php echo $row[ForteID]; ?></option> <?php endforeach; ?> </select> It doesn't die, but not results either in the drop down box. I also took the [ForteID] out of both spots and it still doesnt show any results.
  2. I do not get anything with putting that if statement in. I am pretty sure the query is fine. I think it is something with this part of the code: $resultAsArray = array(); while ( $row = sqlsrv_fetch_array( $result, SQLSRV_FETCH_ASSOC )) { $resultAsArray = $row; } ?> <select> <?php foreach ($resultAsArray as $row): ?> <option value="<?php= $row['ForteID'] ?>"><?php= $row['ForteID'] ?></option> <?php endforeach; ?> </select> I think there is supposed to be more, doesn't seem like it is taking the query results into effect.
  3. MSSQL
  4. Did that and still nothing shows up in the drop down box. Do you want me to repost my code as changes have been made?
  5. <select id="test" name="test"> <?php foreach ($resultAsArray as $row): ?> <option name="ForteID" id="ForteID" value="<?php $row['ForteID'] ?>"><?php $row['ForteID'] ?></option> <?php endforeach; ?> </select> I have this now and now it has nothing in the select box, doesn't even drop down.
  6. Here is how I have my PHP Mail code setup with your information: $senders_email = "$_POST['your_email']"; $recipient_friend = " $_POST['friend_email']"; $subject = "A message from $_POST['your_email']"; $message = "[color=#008800][size=2]A message from $senders_email"[/size][/color][color=#666600][size=2],[/size][/color][color=#000000][size=2] [/size][/color][color=#008800][size=2]"Dear $recipient_friend,\n\nYour friend $senders_email, found ->>>>$test <<<<----very useful, and thought you would be interested.\n\nPlease follow the link to view our site:\nhttp://www.your_sites_address.com\n\nThank You\n\nThe your_sites_address.com[/size][/color]'> $headers = "From: $senders_email\r\n"; $headers .= "Content-type: text/html\r\n"; mail($recipient_friend , $subject, $message ,$headers); Try that and see if you get what you need!
  7. Well, there seem to be no errors. The Values seem to be pulling from the Query, but just not displaying. The drop down box has options just all blank. If I take out the second <?php= $row[ForteID] ?> and put in Select or anything else, it just has a list of Select as all the options.
  8. <h1>View Log</h1> <?php $timezone = "America/Chicago"; date_default_timezone_set($timezone); $today = date("Y-m-d"); ?> <?php $serverName = 'Server\SQLEXPRESS'; $connectionInfo = array('Database'=>'database', 'UID'=>'username', 'PWD'=>'password','ReturnDatesAsStrings'=>true,); $connection = sqlsrv_connect($serverName, $connectionInfo); $query = ' SELECT ForteID FROM database.dbo.Reps ORDER By ForteID'; $result = sqlsrv_query($connection,$query); // Move the data to a simple array to simplify presentation code. $resultAsArray = array(); while ( $row = sqlsrv_fetch_array( $result, SQLSRV_FETCH_ASSOC )) { $resultAsArray = $row; } ?> <form method="get" action="getlog.php"> <select> <?php foreach ($resultAsArray as $row): ?> <option value="<?php= $row['ForteID'] ?>"><?php= $row['ForteID'] ?></option> <?php endforeach; ?> </select> <BR> <table> <tr> <td>Start Date:</td> <td><input name="start_date" type="date" value="<?php echo $today;?>" autocomplete="off" required="required"></td> </tr> <tr> <td>End Date:</td> <td><input name="end_date" type="date" value="<?php echo $today;?>" autocomplete="off" required="required"></td> </tr> </table> <br> <input type="submit" name="getLog" value="Get Log"><br><br> <input type="button" value="Back to Form" onclick="window.location.href='index.php';"> <br> </form> </html> My result for the drop down box is nothing. I believe something is wrong with the while ( $row = sqlsrv_fetch_array( $result, SQLSRV_FETCH_ASSOC )) Thanks in advance for the help.
×
×
  • 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.