rogerc
Members-
Posts
11 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
rogerc's Achievements
Newbie (1/5)
0
Reputation
-
Hi I need help finding why i cant get my rollover buttons to work.The first image state shows up ok but the second cant .The error i get is that the images are not defined but i think the problem is that the code cant read through the slashes in the code , anybody have any ideas thanks rogerc <? //start a session session_start(); //check if user is coming from a form if ($_POST[op] == "ds") { //check username and password if (($_POST[username] != "admin") || ($_POST[password] != "abc123")) { //handle bad login $msg = "<P><font color=\"#FF0000 \"><strong>Bad Login - Try Again</strong></font></P>"; $show_form = "yes"; } else { //handle good login $_SESSION[valid] = "yes"; $show_menu = "yes"; } } else { //determine what to show if ($_SESSION[valid] == "yes") { $show_menu = "yes"; } else { $show_form = "yes"; } } //build form block $form_block ="<h1>Login</h1> <form method=POST action=\"$_SERVER[php_SELF]\"> $msg <P><strong>username:</strong><br> <input type=\"text\" name=\"username\" size=15 maxlength=25></P> <P><strong>password:</strong><br> <input type=\"password\" name=\"password\" size=15 maxlength=25></P> <input type=\"hidden\" name=\"op\" value=\"ds\"> <P><input type=\"submit\" name=\"submit\" value=\"login\"></P> </FORM>"; //build menu block $menu_block ="<p align=\"center\"><img border=\"0\" src=\"mulroy_logo.gif\" width=\"500\" height=\"50\"></p> <p align=\"left\"><img border=\"0\" src=\"logo.gif\" width=\"100\" height=\"100\" align=\"right\"><img border=\"0\" src=\"logo.gif\" width=\"100\" height=\"100\"></p> <ul> <h3>Select the option that you would like to do Add,Edit,Delete or view a students info</h3> <p align=\"center\"><A HREF=\"do_addstudent.php\" onmouseover=\"document.sub_but.src=navbar_r2_c4.gif\" onmouseout=\"document.sub_but.src=navbar_r2_c4_f2.gif\"> <IMG SRC=\"images/navbar_r2_c4.gif\" WIDTH=\"143\" HEIGHT=\"39\" BORDER=\"0\" ALT=\"Add Student\" NAME=\"sub_but\"> <a align=\"center\"><A HREF=\"pick_modstudent.php\" onmouseover=\"document.sub_but.src=edit_results.gif\" onmouseout=\"document.sub_but.src=edit_results_f2.gif\"> <IMG SRC=\"images/edit_results\" WIDTH=\"143\" HEIGHT=\"39\" BORDER=\"0\" ALT=\"Edit Student\" NAME=\"sub_but\"></a> <a align=\"center\"><A HREF=\"pick_delstudent.php\" onmouseover=\"document.sub_but.src=delete_results.gif\" onmouseout=\"document.sub_but.src=delete_results_f2.gif\"> <IMG SRC=\"images/delete_results.gif\" WIDTH=\"143\" HEIGHT=\"39\" BORDER=\"0\" ALT=\"Delete Student \" NAME=\"sub_but\"></a> <a align=\"center\"><A HREF=\"search.php\" onmouseover=\"document.sub_but.src=view_results.gif\" onmouseout=\"document.sub_but.src=view_results_f2.gif\"> <IMG SRC=\"images/view_results.gif\" WIDTH=\"143\" HEIGHT=\"39\" BORDER=\"0\" ALT=\"View Student\" NAME=\"sub_but\"></a> </ul>"; //assign the block to show to the $display_block variable if ($show_form == "yes") { $display_block = $form_block; } else if ($show_menu == "yes"){ $display_block = $menu_block; } ?> <HTML> <HEAD> <TITLE></TITLE> </HEAD> <BODY> <? echo "$display_block"; ?> </BODY> </HTML>
-
hi put the extensions in but still does not come out right thanks
-
hi Having trouble with some javascript.i have four rollover buttons that are not showing and the error that i am getting is saying that my images are not defined ,any body have any ideas thanks rogerc heres the code <? //start a session session_start(); //check if user is coming from a form if ($_POST[op] == "ds") { //check username and password if (($_POST[username] != "admin") || ($_POST[password] != "abc123")) { //handle bad login $msg = "<P><font color=\"#FF0000 \"><strong>Bad Login - Try Again</strong></font></P>"; $show_form = "yes"; } else { //handle good login $_SESSION[valid] = "yes"; $show_menu = "yes"; } } else { //determine what to show if ($_SESSION[valid] == "yes") { $show_menu = "yes"; } else { $show_form = "yes"; } } //build form block $form_block ="<h1>Login</h1> <form method=POST action=\"$_SERVER[php_SELF]\"> $msg <P><strong>username:</strong><br> <input type=\"text\" name=\"username\" size=15 maxlength=25></P> <P><strong>password:</strong><br> <input type=\"password\" name=\"password\" size=15 maxlength=25></P> <input type=\"hidden\" name=\"op\" value=\"ds\"> <P><input type=\"submit\" name=\"submit\" value=\"login\"></P> </FORM>"; //build menu block $menu_block ="<p align=\"center\"><img border=\"0\" src=\"mulroy_logo.gif\" width=\"500\" height=\"50\"></p> <p align=\"left\"><img border=\"0\" src=\"logo.gif\" width=\"100\" height=\"100\" align=\"right\"><img border=\"0\" src=\"logo.gif\" width=\"100\" height=\"100\"></p> <ul> <h3>Select the option that you would like to do Add,Edit,Delete or view a students info</h3> <p align=\"center\"><A HREF=\"do_addstudent.php\" onmouseover=\"document.sub_but.src=navbar_r2_c4\" onmouseout=\"document.sub_but.src=navbar_r2_c4_f2\"> <IMG SRC=\"images/navbar_r2_c4.gif\" WIDTH=\"143\" HEIGHT=\"39\" BORDER=\"0\" ALT=\"Add Student\" NAME=\"sub_but\"> <a align=\"center\"><A HREF=\"pick_modstudent.php\" onmouseover=\"document.sub_but.src=edit_results\" onmouseout=\"document.sub_but.src=edit_results_f2\"> <IMG SRC=\"images/edit_results\" WIDTH=\"143\" HEIGHT=\"39\" BORDER=\"0\" ALT=\"Edit Student\" NAME=\"sub_but\"></a> <a align=\"center\"><A HREF=\"pick_delstudent.php\" onmouseover=\"document.sub_but.src=delete_results\" onmouseout=\"document.sub_but.src=delete_results_f2\"> <IMG SRC=\"images/delete_results.gif\" WIDTH=\"143\" HEIGHT=\"39\" BORDER=\"0\" ALT=\"Delete Student \" NAME=\"sub_but\"></a> <a align=\"center\"><A HREF=\"search.php\" onmouseover=\"document.sub_but.src=view_results\" onmouseout=\"document.sub_but.src=view_results_f2\"> <IMG SRC=\"images/view_results.gif\" WIDTH=\"143\" HEIGHT=\"39\" BORDER=\"0\" ALT=\"View Student\" NAME=\"sub_but\"></a> </ul>"; //assign the block to show to the $display_block variable if ($show_form == "yes") { $display_block = $form_block; } else if ($show_menu == "yes"){ $display_block = $menu_block; } ?> <HTML> <HEAD> <TITLE></TITLE> </HEAD> <BODY> <? echo "$display_block"; ?> </BODY> </HTML>
-
hi Jon you right i deleted evering fron the database and re entered it and work fine thanks rogerc
-
hi yeah no go thanks for the try rogerc
-
hi Having a problem with displaying all the results from my table.I can return the first 5 but the others come back zero if anyone can see the problem your help is much appreciated . thanks rogerc <?php // Get the search variable from URL $var = @$_GET['q'] ; $trimmed = trim($var); //trim whitespace from the stored variable // rows to return $limit=10; // check for an empty string and display a message. if ($trimmed == "") { echo "<p>Please enter a search...</p>"; exit; } // check for a search parameter if (!isset($var)) { echo "<p>We dont seem to have a search parameter!</p>"; exit; } //connect to your database mysql_connect("localhost"); //specify database mysql_select_db("resultsdb") or die("Unable to select database"); //select which database we're using // Build SQL Query $query = "select * from grades where f_name like \"%$trimmed%\" order by f_name"; $numresults=mysql_query($query); $numrows=mysql_num_rows($numresults); if ($numrows == 0) { echo "<h4>Results</h4>"; echo "<p>Sorry, your search: "" . $trimmed . "" returned zero results</p>"; } // next determine if s has been passed to script, if not use 0 if (empty($s)) { $s=0; } // get results $query .= " limit $s,$limit"; $result = mysql_query($query) or die("Couldn't execute query"); // display what the person searched for echo "<p>You searched for: "" . $var . ""</p>"; // begin to show results set echo "Results"; $count = 1 + $s ; // now you can display the results returned while ($row= mysql_fetch_array($result)) { $title = $row["f_name"]; $l_name =$row['l_name']; $address1 =$row['address1']; $address2 =$row['address2']; $address3 =$row['address3']; $english =$row['english']; $irish =$row['irish']; $math =$row['math']; $science =$row['science']; $geography =$row['geography']; $history =$row['history']; echo "$count.) $title ,$l_name,$address1, $address2, $address3, $english, $irish, $math, $science, $geography, $history" ; $count++ ; } $currPage = (($s/$limit) + 1); //break before paging echo "<br />"; // links to other results if ($s>=1) { // bypass PREV link if s is 0 $prevs=($s-$limit); print " <a href=\"$PHP_SELF?s=$prevs&q=$var\"><< Prev 10</a>  "; } // calculate number of pages needing links $pages=intval($numrows/$limit); // $pages now contains int of pages needed unless there is a remainder from division if ($numrows%$limit) { // has remainder so add one page $pages++; } // check to see if last page if (!((($s+$limit)/$limit)==$pages) && $pages!=1) { // not last page so give NEXT link $news=$s+$limit; echo " <a href=\"$PHP_SELF?s=$news&q=$var\">Next 10 >></a>"; } $a = $s + ($limit) ; if ($a > $numrows) { $a = $numrows ; } $b = $s + 1 ; echo "<p>Showing results $b to $a of $numrows</p>"; ?> (edited by kenrbnsn to add the tags)
-
Hi thanks for getting back to me. I made the changes you said to do but the page is still coming up blank rogerc
-
hi i am having problems with displaying results from my databse. The first part of the code search.html runs when selcted from my main menu.The problem is when I hit the submit button the results.php page does'nt appear, anybody have any idea why this is happening thanks roger c heres the code search.html <html> <head> <title></title> </head> <body> <h1> </h1> <form action="results.php" method="post"> Enter In Student Name:<br/> <input name="searchterm" type="text"> <br/> <input type="submit"value="Search"> </form> </body> </html> results.php ... <html> <head> <title></title> </head> <body> <h1>Student Search Result</h1> <? // create short variable names $searchterm = $$HTTP_POST_VARS['searchterm']; $searchterm = trim($searchterm); if (!$searchterm ) { echo 'You have not entered search details. Please go back and try again.'; exit; } if (!get_magic_quotes_gpc()) { $searchterm = addslashes($searchterm); } $db_name = "resultsdb"; @ $db = mysql_connect('localhost', 'resultsdb'); if( !$db) { echo 'Error: Could not connect to database. Please try again later.'; exit; } $query = "select * from grades where like '%".$searchterm."%'"; $result = $db->query($query); $num_results = $result->num_rows; echo '<p>Number of Students found: '.$num_results.'</p>'; for ($i=0; $i < $num_results; $i++) { $row = $result->fetch_assoc(); echo '<p><strong>'.($i+1). '. Title: '; echo htmlspecialchars(stripslashes($row['f_name'])); echo '</strong><br />Author: '; echo stripslashes($row['l_name']); echo '<br />ISBN: '; echo stripslashes($row['address1']); echo '<br />Price: '; echo stripslashes($row['address2']); echo '<br />Price: '; echo stripslashes($row['address3']); echo '<br />Price: '; echo stripslashes($row['english']); echo '<br />Price: '; echo stripslashes($row['irish']); echo '<br />Price: '; echo stripslashes($row['math']); echo '<br />Price: '; echo stripslashes($row['science']); echo '<br />Price: '; echo stripslashes($row['geography']); echo '<br />Price: '; echo stripslashes($row['history']); echo '</p>'; } $result->free(); $db->close(); ?> </body> </html>
-
hi I need to change the drop down box to a text box so that i can serach the database by the keyboard eg if I press A all the records starting with A would show up if that could be done thanks
-
Hello I am new to php and need some help,The code below is for selecting a record to delete through drop down list.I wonder could it be possible to change it text a box where you type a letter and all the records starting with it would be shown its been wrecking my head for yonks i have no idea how to fix it any help would be greatly appreciated this is the code for it. thanks rogerc <? //start a session session_start(); //check validity of user if ($_SESSION[valid] != "yes"){ header("Location:http://127.0.0.1/contact_menu.php"); exit; } //set up table and database names $db_name = "resultsdb"; $table_name = "grades"; //connect to server and select database $connection = @mysql_connect("localhost") or die(mysql_error()); $db = @mysql_select_db($db_name,$connection) or die(mysql_error()); //build and issue query $sql ="SELECT id, f_name, l_name FROM $table_name ORDER BY l_name"; $result = @mysql_query($sql,$connection) or die(mysql_error()); //check the number of results $num = @mysql_num_rows($result); if ($num < 1) { //if there are no results,display message $display_block = "<P>Sorry!No results.</p>"; } else { //if results are found,loop through them //and make a form selection block while ($row =mysql_fetch_array($result)){ $id = $row['id']; $f_name = $row['f_name']; $l_name = $row['l_name']; $option_block .="<option value=\"$id \">$l_name,$f_name</option>"; } //create the entire form block $display_block =" <FORM METHOD=\"POST\" ACTION=\"show_delcontact.php\"> <P><strong>Student:</strong> <select name=\"id\"> $option_block </select> <INPUT TYPE=\"SUBMIT\" NAME=\"submit\" VALUE=\"Select Student\"></P> </form>"; } ?> <HTML> <HEAD> <TITLE></TITLE> </HEAD> <BODY> <h1></h1> <P>Select Student Info from the list below.</P> <? echo "$display_block"; ?> <p><a href="contact_menu.php">Return to Main Menu[/url]</p> </BODY> </HTML>
-
Hello I am new to php and need some help,The code below is for selecting a record to delete through drop down list.I wonder could it be possible to change it text a box where you type a letter and all the records starting with it would be shown thanks rogerc <? //start a session session_start(); //check validity of user if ($_SESSION[valid] != "yes"){ header("Location:http://127.0.0.1/contact_menu.php"); exit; } //set up table and database names $db_name = "resultsdb"; $table_name = "grades"; //connect to server and select database $connection = @mysql_connect("localhost") or die(mysql_error()); $db = @mysql_select_db($db_name,$connection) or die(mysql_error()); //build and issue query $sql ="SELECT id, f_name, l_name FROM $table_name ORDER BY l_name"; $result = @mysql_query($sql,$connection) or die(mysql_error()); //check the number of results $num = @mysql_num_rows($result); if ($num < 1) { //if there are no results,display message $display_block = "<P><em>Sorry!No results.</em></p>"; } else { //if results are found,loop through them //and make a form selection block while ($row =mysql_fetch_array($result)){ $id = $row['id']; $f_name = $row['f_name']; $l_name = $row['l_name']; $option_block .="<option value=\"$id \">$l_name,$f_name</option>"; } //create the entire form block $display_block =" <FORM METHOD=\"POST\" ACTION=\"show_delcontact.php\"> <P><strong>Student:</strong> <select name=\"id\"> $option_block </select> <INPUT TYPE=\"SUBMIT\" NAME=\"submit\" VALUE=\"Select Student\"></P> </form>"; } ?> <HTML> <HEAD> <TITLE></TITLE> </HEAD> <BODY> <h1></h1> <P>Select Student Info from the list below.</P> <? echo "$display_block"; ?> <br> <p><a href="contact_menu.php">Return to Main Menu</a></p> </BODY> </HTML>