fobos 19 Posting Whiz in Training

^^That right there tells me you don't even know how to use functions. Go back to basics bro.

If i wanted a dickhead answer, i would have asked for it.

Thanks diafol. Im still learning how that works.

fobos 19 Posting Whiz in Training

First off you are trying to pass test.php, and you show your add.php, so nothing is going to happen there. Second, in your add.php, you need a connection and an id that gets passed from the ajax function. I would suggest that you get the example from w3shools so you get a basic idea. Its a learning process, but you will get it.

fobos 19 Posting Whiz in Training

This is a really good website that i learned from.

W3Schools

fobos 19 Posting Whiz in Training

you can try using the LIKE operator in your mysql statement.

SELECT fields FROM database WHERE field LIKE 'variable'

ex
SELECT lastName, firstName FROM employees WHERE firstName LIKE 'a%'
fobos 19 Posting Whiz in Training

Hello, i redid your coding and took out the $nt in the action and added a name tag to ur option. Also, just noting, you hae to have a ? mark when passing variables through a URL.

 <?php
 $sql = "SELECT DISTINCT dept FROM sw_lic WHERE dept != ''"; // (1)
 $result2 = mysql_query($sql);
 ?>
 <form action="NB_sw_lic/filter_view.php" method="POST"> // (2)
 <select name="dept"> // (3)
 <?php
 while($nt=mysql_fetch_array($result2))
 {
 echo "<option name='dept' value=$nt[dept]>$nt[dept]</option>";
 }
 ?>
 </select>
 <input type="submit" name="submit" value="Submit">

Now when the form gets submitted filter_view.php, use $_POST['dept'] to get the value.

$nt = $_POST["dept"];
$result = mysql_query("SELECT * FROM sw_lic WHERE dept = $nt")

Let me know if this works

cscheck commented: Solved my question! +0
fobos 19 Posting Whiz in Training

Well i was searching around googling the work cosymantecbfw and i think it relates to ' co symantec bfw' for symantec. Are you running any symantec programs?

fobos 19 Posting Whiz in Training

So you want to use an input box to navigate through pages?

diafol commented: That was some feat to make sense of that! :) +14
fobos 19 Posting Whiz in Training

First off i see that you are using double quotes on the id after $_GET. The only time you use get, is when you are passing variable through a URL, in this case you are not.

mysql_query("UPDATE table SET status = 1 WHERE id = '". $_GET['repid']."'", $c2) or die(mysql_error());

Needs to be

mysql_query("UPDATE table SET status = 1 WHERE id = '". $_POST['repid']."',$c2) or die(mysql_error());

And just like bollabr said, change your forms from method="get" to method="post" action="<?php $_SERVER['PHP_SELF'] ?>". Also, what is $c2 for because you are not referencing to a field to update?

fobos 19 Posting Whiz in Training

Mark solved please!

Sahil89 commented: :D ya its really bad thing, newbies should learn it. +2
fobos 19 Posting Whiz in Training

you could just use PHP redirect.

<?php
session_start();
$_SESSION["visiting"] = $_GET["userid"];
echo $_SESSION["visiting"." ".$_GET["userid"];
header("Refresh: 10; URL=http://localhost/fi.php"); //Refreshes after 10 seconds
?>

make sure this goes above <html> or you will get errors.

fobos 19 Posting Whiz in Training

You need to make your parent div have a position: relative and #answer 1 & 2 need to have position:absolute; z-index: 100

# .cont a { text-decoration:none; font-family: Calibri, Arial, sans-serif; font-size: 14px; color:#000; position:relative}
#answer1 { border: 1px solid black; color: grey; width: 300px; display:none; margin-left: 115px; margin-top: -15px; padding: 10px; font-size: 12px; font-family: Calibri, Arial, sans-serif; height: 135px; position:absolute; z-index: 150; }
#answer2 { border: 1px solid black; color: grey; width: 300px; display:none; margin-left: 115px; margin-top: -15px; padding: 10px; font-size: 12px; font-family: Calibri, Arial, sans-serif; height: 135px; position:absolute; z-index: 150; }
Albert Pinto commented: Thanx.... +0
fobos 19 Posting Whiz in Training

When using the insert statement, there is no need to include the "ID" field. Since your database has auto encriment, it will add it for you automatically. So take out the "ID" in the INSERT statement and '' in the VALUES.

fobos 19 Posting Whiz in Training

Make sure the css' are not conflicting. There has been many times where i have had that happen to me. Did you build the floating menu on your computer?

fobos 19 Posting Whiz in Training

Try FireQuery. Its an extension for jQuery developers.

fobos 19 Posting Whiz in Training

Ajax is not an installation.
AJAX is based on internet standards, and uses a combination of:
-XMLHttpRequest object (to exchange data asynchronously with a server)
-JavaScript/DOM (to display/interact with the information)
-CSS (to style the data)
-XML (often used as the format for transferring data)

AJAX applications are browser- and platform-independent!

fobos 19 Posting Whiz in Training

Try this

<?php
$host="localhost"; // Host name 
$username=""; // Mysql username 
$password=""; // Mysql password 
$db_name="test"; // Database name 
$tbl_name="members"; // Table name 

// Connect to server and select databse.
mysql_connect("$host", "$username", "$password")or die("cannot connect"); 
mysql_select_db("$db_name")or die("cannot select DB");

// username and password sent from form 
$myusername=$_POST['myusername']; 
$mypassword=$_POST['mypassword']; 

// To protect MySQL injection (more detail about MySQL injection)
$myusername = stripslashes($myusername);
$mypassword = stripslashes($mypassword);
$myusername = mysql_real_escape_string($myusername);
$mypassword = mysql_real_escape_string($mypassword);

$sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'";
$result=mysql_query($sql);

// Mysql_num_row is counting table row
$count=mysql_num_rows($result);
// If result matched $myusername and $mypassword, table row must be 1 row

if($count==1){
// Register $myusername, $mypassword and redirect to file "login_success.php"
session_register("myusername");
session_register("mypassword"); 
session_start();
if(!session_is_registered(myusername)){
header("location:main_page.php");
}
}
else {
echo "Wrong Username or Password";
}
?>

Then put this at the top of each page;
session_start();
$username = $_SESSION;
$password = $_SESSION;

-==Zero==- commented: You Are Awesome Thanks +3
fobos 19 Posting Whiz in Training

Try this

<script type="text/javascript"> 
function validate() {            
    var FieldVal = document.getElementById('FieldName').value;                 
    if(FieldVal < 51) {           
        alert("Valid!");         
    } else {             
        alert("Invalid");     
    } 
}
</script>      
<input id="FieldName" type="text" name="MyField" onKeyUp="validate()" MaxLength="2" />
fobos 19 Posting Whiz in Training

ok, first thing is your using $result twice, basically you have colliding variables. second thing is that your insert statement is incorrect. Whenever you use an insert statement you need to define the table fields, then use the "VALUES" to insert into the table fields.

$name=$_POST["name"];
$addressline1=$_POST["addressline1"];
$addressline2=$_POST["addressline2"];
$email=$_POST["email"];

$con = //Connection;
mysql_select_db("db", $con);
$sql = "INSERT into table(name,addressline1,addressline2,email) VALUES('$name','$addressline1','$addressline2','$email')";
if(mysql_query($sql,$con)) {
    die('Error: ' . mysql_error());
} else {
    print "name=$name addressline1=$addressline1 addressline2=$addressline2 email=$email ";
}

On the database display, you cannot use 0 or 1 or 2 or 3. define them from your table fields. Also, you have to use fetch_array not fetch_row. A really great website is www.w3schools.com

fobos 19 Posting Whiz in Training

thats why. i used to have the same problem when i launched it in http://localhost/. Try launching it with the site name or ip address and this shouldnt happen

Zexsz commented: I didn't understand immediately, but it fixed my problem. +0
fobos 19 Posting Whiz in Training

Zagga, yes you can still use the method you are using now where you display the data on one page and analyze it on another. Using the back button, to go back to form after submit, never really works for analyzing the data. If im not mistaken, when you fix the errors, then you have to submit again.. right? which will add another entry to the database. If thats wrong, sorry. One thing that i do is have a form page, a display page, and an editing page. This, in my opinion, would be the easiest.
ex.. page1.php

<?php if(isset9$_POST['submit'])) {
// connection
// insert to db.. $sql = "INSERT INTO.."
   if(!mysql_query($sql,$con)) {
       die('ERROR: ' . mysql_error());
   } else {
       header("location:page2.php");
   }
} ?>
<head>
</head>
<body>
<form action='$_SERVER['PHP_SELF']' method='post'>
<input type='text' name='field1' />
<input type='submit' name='submit' value='Add' />
</form>
</body>

page2.php

<?php
//connection
//dislay database
// a link to call page3 using the id
<td>".$row['field1']."<a href='page3.php?id=".$row['id']."'>Update</a></td>
?>

page3.php

<?php
if(isset($_POST['change'])) {
//connection
mysql_query("UPDATE..SET.. WHERE id = '$_POST[id]'");
header("location:page2.php");
}
<head>
</head>
<body>
<?php
// connection
$sql = "SELECT * FROM table WHERE id = '$_GET[id]'";
$result = mysql_query($sql);
$row = mysql_fetch_array($result);
?>
<form action='<?php $_SERVER['PHP_SELF']?>' method='post'>
<input type='hidden' name='id' value='<?php echo $row['id'] ?>'>
//other form fields
<input type='submit' name='change' value='Update' />
</form>

Like i said, this always works for me.. i find it the most easiest. Also, you would need to empliment a session for login in order to see "update" when you are logged in. I hope …