fobos 19 Posting Whiz in Training
fobos 19 Posting Whiz in Training

If your not getting anythinng in the drop down box, try this.

You: //Changes are in RED

while($row = mysql_fetch_array($result)) { 			
    $kinase = $row['kinase'];			
    $tracer_conc = $row['tracer_conc']; 			
    $options.= "<option value='$id'>".$kinase; 
    // You do not have ID defined in $row..		
} 		
echo "</select>"; <-- Why is this here? 		
?>                 
<select name="users" onchange="showUser(this.value)">	            
<option value="">Select a Kinase:</option>	            
<?=$options?> // Never write in shorthand. Confuses with XML
</select>

New:

$row = mysql_fetch_array($result);			
$kinase = $row['kinase'];			
$tracer_conc = $row['tracer_conc']; 			
$options = "<option value='".$row['id']."'>$kinase</option>"; 					
?>                 
<select name="users" onchange="showUser(this.value)">	            
<option value="">Select a Kinase:</option>	            
<?php echo $options ?>
</select>

I changed while($row = mysql_fetch_array($result)) { to $row = mysql_fetch_array($result); because when you had it your way, that only queries in the curly brackets. The other way, you can pass variables thru out the page. If im wrong, sorry. This is what i always do. I hope this helps

fobos 19 Posting Whiz in Training

Are you able to echo username and password after the if($_SERVER["REQUEST_METHOD"] == "POST")?

fobos 19 Posting Whiz in Training

first off, you cannot put session_start() at the top of a login page, because there is no session yet. I would just take out $_SERVER["REQUEST_METHOD"] == "POST") unless you know that the variables are being posted. Try this because i have a feeling you got this from another website.. Also, you dont need to make a session variable on the login screen because you are already going to register the username. If you want to register more variables, then add them to the to session_register.

session_register("myusername");
session_register("mypassword"); 
// Dont Need
$_SESSION['login_user']=$myusername;
<?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_register("active");
header("location:login_success.php");
}
else {
echo "Wrong Username or Password";
}
?>
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

Also, its bad practice to write your php tags in shorthand.

fobos 19 Posting Whiz in Training

go to w3schools.com and go to the php section and start learning. Then come back with what you have.

fobos 19 Posting Whiz in Training
fobos 19 Posting Whiz in Training

are you using localhost or computer IP in your url. localhost will be fine, but you have to configure using your computer IP

fobos 19 Posting Whiz in Training

Ok, if you wrote a session login page, then you know something about variables! If you just want the href, then use it in a variable?

if logged in
$link = "http://www.test.com/signup.php";
$img = "/images/rester.png";
$alt = "Please Register";
else
$link = "http://www.test.com/thanks.php";
$img = "/images/vote.png";
$alt = "Vote";

Hope this helps

fobos 19 Posting Whiz in Training

try using <?php $_SERVER?>/admin/validateLogin/ in your form action.

fobos 19 Posting Whiz in Training

You have an error on line 11, you need to add ">" to then end of the image tag.
Also try this.

ob_start();    
session_start();    
if(!isset($_SESSION['Username'])) {	
    echo "<a href='http://www.test.com/signup.php'><img src='/images/register.png' alt='Please Register'/></a>";	
} else {	
    echo "<a href='http://www.test.com/thanks.php'><img src='/images/vote.png' alt='Vote'></a>";
}
fobos 19 Posting Whiz in Training

Oh ok. Im glad you found the issue and it is working. Please mark the thread solved.

fobos 19 Posting Whiz in Training

var/www/ is the root folder where all your php documents should go. If it works there, that means that its the root directory. Trying running phpinfo in that folder.

fobos 19 Posting Whiz in Training

Mark it solved BilalAKhan!! Its down near the bottom by the quick reply.

fobos 19 Posting Whiz in Training

if your getting Hello World '; ?> it means that its echoing part of of the string.
if it wasnt working, 1) would be able to view the php page, 2) it would write it just as you have it <?php... ?>.

just write it, but try phpinfo() first

<?php phpinfo(); ?>
<?php echo "hello world"; ?>
<? echo "hello world"; ?>
fobos 19 Posting Whiz in Training

Its above the quick reply on the bottom.

fobos 19 Posting Whiz in Training

If you want to insert data into 2 tables in the same database, then use UNION. If you have 2 databases, but same table name, 1) make sure you have the same fields, 2) use 2 connections for each database.

fobos 19 Posting Whiz in Training

Try this attachment. It will tell you what port is being used and whats not. Next time, please post this in the correct forum. This has nothing to do with PHP, this is more of a software thing. On another note, google XAMPP. This is a really great bundle that comes with alot of different scripting languages.

fobos 19 Posting Whiz in Training

Here is a link to what you are looking for.

Click Here

fobos 19 Posting Whiz in Training

i forgot to add the ' ' to it in the values

fobos 19 Posting Whiz in Training

Try this.

$date = date("Y-m-d H:i:s"); 
INSERT INTO equardIPs (start) VALUES(" . $date . ")
fobos 19 Posting Whiz in Training

For 1), just create a php, cf, or asp page and call it swf_page.ext. Next set the CSS body, html, and swf height + width to 100%. Then embed the swf object. When you lauch the page, it should take up the whole screen. next make it where the params get what is passed in the url.

For 2), you will have to pass the parameters using a link. So we will call this main.html. create an iframe (width 300, height 300) and a side nav with a link.

<script type="text/javascript">
function pass_param(param1) {
    document.getElementById("iframe").src = "swf_page.ext?height="+param1;
}
</script>
<a onlick="pass_param('100')">Adjust height to 100</a>

Or if you want to use more than one parameter.

<script type="text/javascript">
function pass_param() {
    var param1 = document.getElementById("input1").value; 
    var param2 = document.getElementById("input2").value;
    document.getElementById("iframe").src = "swf_page.ext?param1="+param1+"&param2="+param2;
}
</script>
<form>
<input type="text" id="input1">
<input type="text" id="input2">
<a onlick="pass_param()">Submit</a>

i hope this helps

fobos 19 Posting Whiz in Training

instead of

<a href="#" class="leftlinks" onclick="updateParent(control)" id="2" value="2">CLICK HERE</a>

the value needs to be in the function on the link, because the function in the script requires a value.

<a href="#" class="leftlinks" onclick="updateParent(2)" id="2" value="2">CLICK HERE</a>

Plus, just try to use

function updateParent(control) {
    window.opener.location.href="index.php?menukey="+control;
}
fobos 19 Posting Whiz in Training

Ok my bad on the post, i wasnt writing to you. Anyways, you have to use the substring method. Sorry for the above post.

fobos 19 Posting Whiz in Training

You would have to use the replace string.

var myString = "this is a string\n that needs \n\n to be on a newline";
var myString2 = myString.replace(/\n/g, "<br>");

document.write (myString2);
fobos 19 Posting Whiz in Training

If this is a registration form, try checking it against the database using a different method.

<?php
$con = mysql_connect("localhost","peter","abc123");
if (!$con) {
  die('Could not connect: ' . mysql_error());
}

mysql_select_db("my_db", $con);

$result = mysql_query("SELECT username FROM users");

while($row = mysql_fetch_array($result)) {
    //if the username matches any username in the database, return it false. Else return insert code.
    if($row['username'] == $_POST['username']) {
        echo "Username Already In Use";
    } else {
        // Insert Code
}

mysql_close($con);
?> 

I havent used PHP in a while, but something like this should work.
fobos 19 Posting Whiz in Training

eswar.aspire,
First off, you need to post your questions in the correct forum. This is purely Javascript not PHP, because your asking a question that has no PHP in it.
Secondly, what you need to have in your parent page is a function that will control the iframe sources.

function load_left(url) {
    document.getElementById("menu").src = url;
}

In the "login_reg" page that gets loaded in the "page_load" iframe, you need to impliment this with the jquery, so when you click submit it calles the function on the parent frame and loades the "menu" iframe with the desired page.

$("#login_form").submit(function() {
    parent.load_left('../pub@lic_profile/@_profile/all_@_all/horizontal_menu/flashmo_114_horizontal_03.swf');
});
fobos 19 Posting Whiz in Training

try using the if else statement.
ex.
if level = 0 use unchecked box else use checked box

fobos 19 Posting Whiz in Training

Ok, well in your up.php you have variables in your post

$p_level9 = $_POST['$u_level9'];

Should be

$p_level9 = $_POST['u_level9'];
fobos 19 Posting Whiz in Training

First off, is the form being populated?

fobos 19 Posting Whiz in Training

Well you have the right idea.. sort of with your if statements, except (in my opinion) they would be better in the checkbox itself. Right now when you use the if else, you are not assigning a variable to the "true" statement. Because of that you cannot reference it in the checkbox. For the easiest solution, try this.

echo"<tr align='center'>";
while($row = mysql_fetch_array($result2))  { 
    echo"<input type='hidden' name='fitem' value='$row[item]'>";   
    echo"<td>$row[item]</td>";

    if($row['level1']=="1") {
        echo "<td><input type='checkbox' name='checkbox1' value='1' checked='checked' /></td>";
    } else {
        echo "<td><input type='checkbox' name='checkbox1' value='0' /></td>";
    }
}
echo "</tr>";

Then when the user clicks the submit button

if(isset($_POST['submit'])) {
 //Your update code
}

By the way, on your update, you have

$fpq= "UPDATE ....";

and you use this

mysql_query($query);

What is the "$query" variable too?

fobos 19 Posting Whiz in Training

Use Navicat for MySQL

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

No your dynamic or static ip address that is givin from your internet provider. ex.. 123.456.789.012

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

when you launch the webpage in the browser, is it
http://localhost/ or
http://yoursite.com/

fobos 19 Posting Whiz in Training

Well the invalid argument is the name that your trying to give it. Now you can adjust this without using top and left, but i do this because when the user clicks on the link the popup window opens in the middle of the screen. If you dont want top and left, just delete them out of the string.

<script type="text/javascript">
var popUpWin = 0;
function popUpWindow(URLStr, width, height) { 
    if(popUpWin) {
        if(!popUpWin.closed) popUpWin.close();
    }
    // now this is where you can delete this "top and left".
    // If you do, delete, "top, left, screenX, screenY".
    var left = document.body.clientWidth/2;
    var top = document.body.clientHeight/2;
    var input1 = document.getElementById("input1").value;
    popUpWin = open(URLStr+'?param1='+input1, 'popUpWin', 'toobar=no,location=no,directories=no,status=no,menubar=no,scrollbar=no,resizable=no,copyhistory=no,width='+width+',height='+height+',left='+left+',top='+top+',screenX='+left+',screenY='+top+'');
}
</script>

<a onclick="popUpWindow('showduty.php',200,200)">click to open</a>

Hope this helps

fobos 19 Posting Whiz in Training

Ok so say we have users.php and i want to see someones profile using the "id" method. Just like what you said http://www.website.com/profile.php?id=1. Well if you have mysql database, just output the a field like names or something. Then with the name being outputed, just assign an href tag to them.. so
Page1.php

<?php
// connection
// output
$result = mysql_query("SELECT * FROM Persons");
while($row = mysql_fetch_array($result)) {
    echo "<a href='profiledispay.php?id=$row[id]'>".$row['FirstName']."</a><br>";
}
?>

Then on Page2.php

<?php
$id = $_GET['id']; // get var from URL
//connection
$result = mysql_query("SELECT * FROM Persons WHERE id = $id");
$row = mysql_fetch_array($result);
?>
<input type="text" value="<?php echo $row['FirstName']?>">

I really hoped this helped. basically when the user clicks on the name, the id is passed to page2 and you use the "get" method to grab the variable. Next we use it in the query to access only the row with that id. If you have further questions, please dont hesitate to ask.

fobos 19 Posting Whiz in Training

Well if the pop-up window is a new paged that is displaying the data, then you want to pass the data via URL..

function passData() {
    var input1 = document.getElementById("input.name").value;
    window.open("showduty.php?param1="+input1);
}

Let me know if this is what you are looking for?

fobos 19 Posting Whiz in Training

Try creating a seperate page to see if the variables are being passed after validating.

<?php
if(isset($_POST['submit'])) {
    echo $_POST['getName'];
    echo $_POST['getPass'];
}
?>

If they are, try this code.
I think i know what login script your using. If you want, this is the one that i was using..

checklogin.php

<?php
$host = "";
$username = "root";
$password = "";
$db_name = "";

mysql_connect("$host", "$username", "$password") or die("Couldnt Connect");
mysql_select_db("$db_name") or die("Couldnt select db");

$username = $_POST['getName'];
$password = $_POST['getPass'];

$username = stripslashes($username);
$password = stripslashes($password);
$username = mysql_real_escape_string($username);
$password = mysql_real_escape_string($password);

$sql = "SELECT * FROM table WHERE username = '$username' and password = '$password'";
$result = mysql_query($sql);
$count = mysql_num_rows($result);

if($count==1) {
    session_register("username");
    session_register("password");
    header("location:page.html"); // go here if login successful
} else { 
    header("location:wrong.html"); // go here if login failed
}
?>

let me know if this worked..

fobos 19 Posting Whiz in Training

when you display the tables, your mysql query should be

SELECT * FROM table ORDER BY id ASC or DESC // pick either ASC or DESC.

I think that is what you were talking about. If not, please post code so we can analyze it.

fobos 19 Posting Whiz in Training

Ok, if you can copy the values from the fields in editor 1, then this should be able to assign them to editor2.

With the onlick function that was shown, you have to get the values of the input fields in editor 1

function get() {
var input1  = document.getElementById("myinput").value
// now if its a span or input u have to use one or the other
//span
document.getElementById("myspan2").innerHTML = input1;
//input
document.getElementById("myinput2").value = input1;
}

You know, you shouldnt go roaring on the forums how much daniweb sucks and people are un responsive. That makes people not want to help you even more, because your acting like a girl. Second, you need some kind of code to help you or a really good example. People cant see your page. Third, people have lifes. Now i hope this helped.

fobos 19 Posting Whiz in Training

Hello wonderland,
well first off nice site. Ok to get to your question, yes it is possible. Right now, you have the images in an iframe, but the main content is is on the page, so when you click on a link, it just reloads the page and the iframe as well. One thing you might try is putting your site into frames or just do the opposite of what you have now. So maybe something like

<table>
    <tr>
        <td>..the slide show</td>
    </tr>
    <tr>
        <td><iframe src="maincontent.htm"></iframe></td>
    </tr>
</table>

Then for any page in the iframe that has links, just use this.

<script type="javascript">
function go(url) {
    location.href = url;
}
</script>
<a onClick="javascript:go('maincontent.htm')>Home</a>

this way it will only reload the iframe with the next page and not the whole site. This is just a suggestion, let me know if this works for you.

fobos 19 Posting Whiz in Training

Well if your sending it to a different page, where the data gets checked, they why dont you just use a form validator? that way you dont have to run into that problem?
Yes it is fine to have the page submit to itself. Does that answer your question? If your worried about something you could use stripslashes..

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 …

fobos 19 Posting Whiz in Training

You must understand something when posting a forum. We are here to help, but you must show some code to let us know that you are trying. There are no freebies here, so expect handouts.

fobos 19 Posting Whiz in Training

its ok to have buttons in php. just name them different names. Then use the following coding for each button..

<?php
if(isset($_POST['name of button'])) {
// mysql code or php code
} ?>

does this help

fobos 19 Posting Whiz in Training

Here this will help.. i use this in my code..
This list the users. so.. Users.php

<?php
mysql_connect("localhost","root","");
mysql_select_db("my_db");
$result = mysql_query("SELECT * FROM my_table");
while($row = mysql_fetch_array($result)) { echo"
<table width="100%" border="0">
     <tr>
          <td><a href='view_profile.php?id=".$row['id']."'>".$row['name']."</td>
     </tr>
</table>";
}
?>

And this the "view_profile.php". Basically when u click on the name, it passes the ID variable to the next page where you will use it to access the database.

<?php
mysql_connect("localhost","root","");
mysql_select_db("my_db");
$sql = "SELECT * FROM my_table WHERE id=$_GET[id]";
$result = mysql_query($sql);
$row = mysql_fetch_array($result);
?>
<table width="100%" border="0">
     <tr>
          <td>Name:</td>
          <td><?php echo ".$row['name']." ?></td>
     </tr>
     <tr>
          <td>Blah:</td>
          <td><?php ...blah?></td>
     </tr>
</table>

I like it this way, because now you can use HTML to build your stuff and then use a little bit of php code to access the rows.. I really hope this helps.

fobos 19 Posting Whiz in Training

yes there is a way, but its easier with javascript
the key is the "return confirm"

<form action="something.php" onSubmit="return confirm('Are you sure?');" method="post">
// Fields
// Fields
<input type="submit" name="Submit" class="button" value="Submit">
</form>

I hope this helps