Jump to content

swapnali_s230

Members
  • Posts

    11
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

swapnali_s230's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi all I am working on php-html program. I have following code which gives output, I want it in select box. But it is not showing select box. I dont know why? <?php @$today = getdate();@$month=$today[mon];@$year=$today[year];@$num=0; $semester=array("Spring", "Summer I", "Summer II", "Summer", "Fall"); while($num<=5) {$sem= $semester[$num]." ".$year; $num=$num+1;} ?> <td><div id="Gen_Combo"><select id ="Gen_Combo1" name ="combo_gen[]" size="4" style="width: 100px; font-size: 10px;" > <?=$sem?></select></div></td></tr> If I echo $sem, it will print it. But if I try to echo it in select box, it is not showing output...... Thanks in advance
  2. I have one question here... I want to pop up alert box asking "Do you want to add new stuff?" But following code is not working. It is directly going to AddStuff.php without giving alert box. I dont know, why? if ($count==0) { $count0=$count; echo "<script language='javascript' type='text/javascript'>"; echo "var conf= confirm('Do you want to add new stuff?')"; echo "if (conf)"; { header("location:http://000.000.000.00/ABCD/AddStuff.php?cose=$ID"); } echo "</script>"; } If anyone knows, please let me know.
  3. Really sorry for inconvenience...... I had some internet problems when i posted it at first. I thought it didnt go through..... So I posted it again.... Sorry again.
  4. Wow.. It worked ...Thanks
  5. Sorry for inconvenience.. Let me explain you... $query =mysql_query("SELECT Course_ID FROM Course where Student_ID='$Stud_ID' AND Course_Name='COSC 3312' AND Course_Name='COSC 2430'"); $count=mysql_num_rows($query);echo $count; If I try to echo count, it will give me 0. It is supposed to give me 1. That is how it is not working.
  6. I have ONE problem here. My mysql query is not working ..I don't know why? Here is that line - $query =mysql_query("SELECT Course_ID FROM Course where Student_ID='$Stud_ID' AND Course_Name='COSC 3312' AND Course_Name='COSC 2430'"); If anyone knows, let me know....
  7. Thank you very much for reply.... The problem got solved...I used trim function. I have another problem here. My mysql query is not working ..I don't know why? Here is that line - $query =mysql_query("SELECT Course_ID FROM Course where Student_ID='$Stud_ID' AND Course_Name='COSC 3312' AND Course_Name='COSC 2430'");
  8. Hi All I have been working on one program.. Its giving me output for some echo, not for other echos. I dont know why? Following is the code - if (is_array(@$_REQUEST['classes'])) { foreach($_REQUEST['classes'] as $course1) { $sql=mysql_query("SELECT Ma_CoName FROM MCourse where Ma_CoNo='$course1'"); @$course=mysql_result($sql, 0) or die('wrong query'.mysql_error()); if ($course=='ENGL 1301') echo $course; elseif ($course=='ABC 33') echo $course; elseif ($course=="VVV 34") echo $course; elseif ($course=="CCC 95") echo $course; elseif ($course=="MMM 12") echo $course; elseif ($course=="OOO 89") echo $course; elseif ($course=="CCC 75") echo $course; }} Code in bold is not giving me any output, but $course=='ENGL 1301' is giving me output. I dont know why? It is so weird.....
  9. Sorry for trouble understanding it .... I have changed some names here. I have given dummy hostname, user name, password, database name... First page code is - <?php /* * To change this template, choose Tools | Templates * and open the template in the editor. */ define ('DB_HOST','204.158.159.41'); // Host name define('DB_USER','akash'); // Mysql username define('DB_PASSWORD','raje'); // Mysql password define('DB_NAME','check'); // Database name // Connect to server and select database. $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); if(!$link) { die("Could not connect:".mysql_error()); } $db_selected = mysql_select_db(DB_NAME, $link); if(!$db_selected) { die('Can not use'.DB_NAME.':'.mysql_err()); } ?> <html> <head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Check it</title> </head> <link rel="stylesheet" type="text/css" href="atrm.css"/> <form method="POST"> <table width="100%" border="0" cellpadding="3" cellspacing="1" align="center"> <tr> <td colspan="3"><h1>Welcome </h1><hr width="100%"></hr></td> </tr> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/><br/> <tr><td><h3> <p><center> <label id="stud_ID1" for="ID">Enter Student ID:</label> <input type="text" maxlength="30" name="Stud_ID"/> </center></p> </h3></td></tr> <td><center><input type="submit" style="height: 25px; width: 100px" name="BUTTON" <?php @$Stud_ID = $_POST['Stud_ID']; if (isset($_POST['BUTTON'])) { $query2 =mysql_query("SELECT Stud_ID FROM Student WHERE Stud_ID ='$Stud_ID'") or die('wrong query'.mysql_error()); $count=mysql_num_rows($query2); if ($count==1) { header("location:http://204.158.159.41/../Student_Mainpage.php?id='.$Stud_ID"); } else { header("location:http://204.158.159.41/../Errorpage.php"); } if ($Stud_ID =="") header("location:http://204.158.159.41/../BlankIDpage.php"); } ?>value="Submit"> </center></td> </tr> </table> </form> </html> Second page where it is going is - <?php define ('DB_HOST','204.158.159.41'); // Host name define('DB_USER','akash'); // Mysql username define('DB_PASSWORD','raje'); // Mysql password define('DB_NAME','check'); // Database name // Connect to server and select database. $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); if(!$link) { die("Could not connect"); } $db_selected = mysql_select_db(DB_NAME, $link); if(!$db_selected) { die("Can not use".DB_NAME.':'.mysql_err()); } @$Stud_ID = $_POST['Stud_ID']; ?> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <link rel="stylesheet" type="text/css" href="atrm.css" /> <title>Student Main Page</title> <head><h1>Welcome to Main Page</h1> </head> <body> <form name ="mainpage" method='POST'> <table> <tr> <td><label id="Stud_ID2" for="Stud_ID"> Student ID <?php echo "is:" ." ". @$Stud_ID; ?> </label></td> <td> <label id="degree">Degree</label></td> </tr> <tr> <td> <label id="name"> Student Name: <?php $query2 =mysql_query("SELECT Stud_Lastname, Stud_Firstname FROM Student WHERE Stud_ID='.$Stud_ID'") or die('wrong query'.mysql_error()); while($row = mysql_fetch_array($query2)) { echo $row['Stud_Lastname'] . " " . $row['Stud_Firstname']; } ?></label></td> <td><label id="advior">Advisor</label> </td> </tr> </table><br/> </form> </body> </html>
  10. Code form first page is - <?php @$Stud_ID = $_POST['Stud_ID']; if (isset($_POST['BUTTON'])) { $query2 =mysql_query("SELECT Stud_ID FROM Student WHERE Stud_ID ='$Stud_ID'") or die('wrong query'.mysql_error()); ?> code from Second page is - ..... @$Stud_ID = $_GET['Stud_ID']; ..... <table> <tr> <td><label id="Stud_ID2" for="Stud_ID"> Student ID <?php echo "is:" ." ". @$Stud_ID; ?> </label></td> <td> <label id="degree">Degree: Computer Science</label></td> </tr> <tr> <td> <label id="name"> Student Name: <?php $query2 =mysql_query("SELECT Stud_Lastname, Stud_Firstname FROM Student WHERE Stud_ID='$Stud_ID'") or die('wrong query'.mysql_error()); while($row = mysql_fetch_array($query2)) { echo $row['Stud_Lastname'] . " " . $row['Stud_Firstname']; } ?></label></td> <td><label id="advior">Advisor: Dr. H. Lee</label> </td> </tr> </table><br/> .........................
  11. Hi All I am kinda new to php.... I disparately need help with php coding. I am entering in the website using student id. If student id does not exist in mysql database, it gives me error. That works fine. But If I try to echo StudentID on 2nd page, it is not displaying anything. Second problem is I want to display student first and last name using StudentID. But it is not displaying anything using StudentID. Why? I have been trying to solve it, but no success Following is the code for both problems - if(!$db_selected) { die("Can not use".DB_NAME.':'.mysql_err()); } @$Stud_ID = $_POST['Stud_ID']; ?> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <link rel="stylesheet" type="text/css" href="ACSDP.css" /> <title>Student Main Page</title> <head><h1>Welcome to Undergraduate Student Main Page</h1> </head> <body> <form name ="mainpage" method='POST'> <table> <tr> <td><label id="Stud_ID2" for="Stud_ID"> Student ID <?php echo "is:" ." ". @$Stud_ID; ?> </label></td> <td> <label id="degree">Degree: Computer Science</label></td> </tr> <tr> <td> <label id="name"> Student Name: <?php $query2 =mysql_query("SELECT Stud_Lastname, Stud_Firstname FROM Student WHERE Stud_ID='$Stud_ID'") or die('wrong query'.mysql_error()); while($row = mysql_fetch_array($query2)) { echo $row['Stud_Lastname'] . " " . $row['Stud_Firstname']; } If have made those statements bold. please help me......
×
×
  • 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.