Jump to content

chrispulliam

Members
  • Posts

    10
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

chrispulliam's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I Have the following 2 statements that I need help with to try to combine <? $query="SELECT * FROM programs"; /* You can add order by clause to the sql statement if the names are to be displayed in alphabetical order */ $result = mysql_query ($query); echo "<select name=program_name value=''></option>"; // printing the list box select command while($nt=mysql_fetch_array($result)){//Array or records stored in $nt echo "<option value=$nt[Title]>$nt[Title]</option>"; /* Option values are added by looping through the array */ } echo "</select>";// Closing of list box ?> <option value="<?php echo $row_processing['eng_review']; ?>" selected="selected"><?php echo $row_processing['eng_review']; ?></option> What I am needing to do is on my form pull in information from a database entry as well as pulling in a predefined list from a separate table.
  2. Here was my issue. Thanks guys for your help! echo "<option value='$nt[Title]'>$nt[Title]</option>";
  3. @The Little Guy I tried to remove the % and it did not work.
  4. Here is my code <?php require_once('../Connections/umdb.php'); ?> <?php require("../Connections/grab_globals.inc.php3") ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $currentPage = $_SERVER["PHP_SELF"]; $maxRows_processing = 10000000; $pageNum_processing = 0; if (isset($_GET['pageNum_processing'])) { $pageNum_processing = $_GET['pageNum_processing']; } $startRow_processing = $pageNum_processing * $maxRows_processing; $program_name = $_POST['program_name']; $colname_processing = "-1"; if (isset($_GET['No'])) { $colname_processing = $_GET['No']; } mysql_select_db($database_umdb, $umdb); $query_processing = "SELECT * FROM media WHERE (program_name LIKE '%$program_name%')"or die(mysql_error()); $query_limit_processing = sprintf("%s LIMIT %d, %d", $query_processing, $startRow_processing, $maxRows_processing); $processing = mysql_query($query_limit_processing, $umdb) or die(mysql_error()); $row_processing = mysql_fetch_assoc($processing); if (isset($_GET['totalRows_processing'])) { $totalRows_processing = $_GET['totalRows_processing']; } else { $all_processing = mysql_query($query_processing); $totalRows_processing = mysql_num_rows($all_processing); } $totalPages_processing = ceil($totalRows_processing/$maxRows_processing)-1; $queryString_processing = ""; if (!empty($_SERVER['QUERY_STRING'])) { $params = explode("&", $_SERVER['QUERY_STRING']); $newParams = array(); foreach ($params as $param) { if (stristr($param, "pageNum_processing") == false && stristr($param, "totalRows_processing") == false) { array_push($newParams, $param); } } if (count($newParams) != 0) { $queryString_processing = "&" . htmlentities(implode("&", $newParams)); } } $queryString_processing = sprintf("&totalRows_processing=%d%s", $totalRows_processing, $queryString_processing); ?> <?php require_once('../auth.php'); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title> user Page</title> <link href="../loginmodule.css" rel="stylesheet" type="text/css" /> </head> <body> <h1>Welcome <?php echo $_SESSION['SESS_NAME'];?></h1> <p><a href="users">Home</a> | <a href="admin">Admin</a> | <a href="logout.php">Logout </a> <form action="reports.php" method="post"> <? $query="SELECT * FROM programs"; /* You can add order by clause to the sql statement if the names are to be displayed in alphabetical order */ $result = mysql_query ($query); echo "<select name=program_name value=''></option>"; // printing the list box select command while($nt=mysql_fetch_array($result)){//Array or records stored in $nt echo "<option value=$nt[Title]>$nt[Title]</option>"; /* Option values are added by looping through the array */ } echo "</select>";// Closing of list box ?></p> <p><br /> <input type="submit" name="submit" value="Submit" /> </p> </form> <p> </p> <p> Records <?php echo ($startRow_processing + 1) ?> to <?php echo min($startRow_processing + $maxRows_processing, $totalRows_processing) ?> of <?php echo $totalRows_processing ?> </p> <table border="1" align="center"> <tr> <td>media_number</td> <td>date_entering</td> <td>program_name</td> <td>program_num</td> <td>comments</td> </tr> <?php do { ?> <tr> <td><a href="users/detail.php?media_number=<?php echo $row_processing['media_number']; ?>"> <?php echo $row_processing['media_number']; ?> </a></td> <td><?php echo $row_processing['date_entering']; ?> </td> <td><?php echo $row_processing['program_name']; ?> </td> <td><?php echo $row_processing['program_num']; ?> </td> <td><?php echo $row_processing['comments']; ?> </td> </tr> <?php } while ($row_processing = mysql_fetch_assoc($processing)); ?> </table> <br /> </body> </html> <?php mysql_free_result($processing); ?>
  5. You can change the time zone a number of ways. To do it via your PHP script follow this link: http://support.modwest.com/content/5/258/en/how-do-i-change-timezone-for-php.html and you can do it within your PHP ini file follow directions here: http://wordpress.org/support/topic/php-530-amp-wp-28-it-is-not-safe-to-rely-on-the-systems-timezone I hope this helps accomplish what your needing!
  6. I have the following two statements in php that I am trying to pass to my database. If I perform a search for Test One with the first statement It displays all entries that have Test One as well as Test Two Test Three and so forth. I then try statement 2 and it does not show me any results. If I Hard code Test One in the search succeeds successfully. What am I doing wrong? Statement 1 "SELECT * FROM media WHERE (program_name LIKE '%$program_name%')" > Statement 2 "SELECT * FROM media WHERE (program_name = '%$program_name%')"
  7. I just noticed the issue! if ($_POST['test'] == "A"){ had a extra space in it.
  8. I just did this the other day. Microsoft has a plugin for installing php http://php.iis.net/ it works like a dream
  9. Sorry forgot to add I am having issues getting the email to work. Regardless of the Text in the form it goes to the first email address listed with all submissions.
  10. I am having issues with my page. I am trying to send a email to a different address based on the entry that my user submits. Here is my form on my test page. <form method=POST action=formdata.php> <table width="640" border=0 align="center"> <tr> <td align=right><b>Test</b></td> <td><input type=text name=test size=25></td> <td> </td> <td> </td> </tr> </table> </dl> <div align="center"> <p> <input type=hidden name=FA value=SendMail> </p> <input type=submit value="Submit Form"> </p> </div> </form> here is the php code for my formdata page <?php $con = mysql_connect("localhost","test","test"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("test", $con); $sql="INSERT INTO formdata (test) VALUES ('$_POST[test]')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "Your Information Was Successfully Posted"; mysql_close($con); if ($_POST['test'] =="A"){ $to = "email@sample.com"; $subject = "Custom Form"; $message = $_POST['test'] ; $headers = "From: email@sample.com"; $sent = mail($to, $subject, $message, $headers) ; } else if ($_POST['test'] =="B"){ $to = "email2@sample.com"; $subject = "Custom Form"; $message = $_POST['test'] ; $headers = "From: email@sample.com"; $sent = mail($to, $subject, $message, $headers) ; } if($sent) {print "<p>Your mail was sent successfully"; } else {print "<p>We encountered an error sending your mail"; } ?>
×
×
  • 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.