Quantcast
Channel: PHP Freaks: PHP Help
Viewing all 13200 articles
Browse latest View live

Create button for popup window to display contents of text file

$
0
0
I have a Php application that already has 2 buttons with input on the index page that perform some functions and output to different Php pages. Works good. How do I add a button with no input that would just perform a function and then just display a popup window showing the contents of a text file? I want to add several of these buttons for different functions and just display the contents of the resulting text files in popup windows. Any help would be greatly appreciated. Thanks in advance.
 

curl login into website not working

$
0
0

I am trying to create a remote login to one website using mine. The users will need to enter their username and password on my site, and if they are registered to my website, their login credentials will be sent to another website and a page will be retrieved.

I am stuck at sending the users' data to the original site. The original site's viewsource is this..

<form method=post>
<input type="hidden" name="action" value="logon">
<table border=0>
<tr>
<td>Username:</td>
<td><input name="username" type="text" size=30></td>
</tr>
<tr>
<td>Password:</td>
<td><input name="password" type="password" size=30></td>
</tr>
<td></td>
<td align="left"><input type=submit value="Sign In"></td>
</tr>
<tr>
<td align="center" colspan=2><font size=-1>Don't have an Account ?</font> <a href="?action=newuser"><font size=-1 color="#0000EE">Sign UP Now !</font></a></td>
</tr>
</table>

I have tried this code, but not works.

<?php
$username="username"; 
$password="password"; 
$url="http://www.example.com/index.php"; 

$postdata = "username=".$username."&password=".$password;

$ch = curl_init(); 
curl_setopt ($ch, CURLOPT_URL, $url); 
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE); 
curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6"); 
curl_setopt ($ch, CURLOPT_TIMEOUT, 60); 
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1); 
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt ($ch, CURLOPT_REFERER, $url); 
curl_setopt ($ch, CURLOPT_POSTFIELDS, $postdata); 
curl_setopt ($ch, CURLOPT_POST, 1); 
$result = curl_exec ($ch); 
header('Location: track.html'); 
//echo $result;  
curl_close($ch);
?>

Any help would be appreciated, Thanks in advance.

php adding and subtracting

$
0
0
Hi ! please help me . im having a trouble with this im actually new to php. 
it says Notice: Undefined index: prev in C:\xampp\htdocs\new\viewbill.php on line 21

Notice: Undefined index: pres in C:\xampp\htdocs\new\viewbill.php on line 22

Notice: Undefined index: price in C:\xampp\htdocs\new\viewbill.php on line 23

Notice: Undefined index: id in C:\xampp\htdocs\new\viewbill.php on line 28

 
<?php
include 'connection.php';
$id = $_GET['id'];
$result = mysql_query("SELECT * FROM meter WHERE reading_id  = '$id'");
 
 
echo "<table border='1' bgcolor='#fff'>
<tr>
<th>Id</th>
<th>Previous Reading</th>
<th>Present Reading</th>
<th>Consuption</th>
<th>Date</th>
<th>Bill Amount</th>
<th>Action</th>
</tr>";
 
while($row = mysql_fetch_array($result)){
 
 $prev=$row['prev'];
 $pres=$row['pres'];
 $price=$row['price'];
 $totalcons=$pres - $prev;
 $bill=$totalcons * $price;
 
  echo "<tr>";
  echo "<td>" . $row['id'] . "</td>";
  echo "<td>" . $prev . "</td>";
  echo "<td>" . $pres . "</td>";
  echo "<td>". $totalcons."</td>";
  echo "<td>" . $price . "</td>";
  echo "<td>" . $bill . "</td>";
  echo "</tr>";
  }
  
echo "</table>";
 
?>
 

Call Function

$
0
0

Hi

 

I'm trying to get the layout like i want but it's not easy

 

I have this file

<?PHP
require_once("./include/membersite_config.php");
if(!$fgmembersite->CheckLogin())
{
    $fgmembersite->RedirectToURL("login.php");
    exit;
}
if(isset($_POST['submitted']))
{
$fgmembersite->PesquisarPorDatas();
}

?>
               
			<div id='fg_membersite_content'>
			<div class="CSSTableGenerator" >
				//I want the result here
			</div>
			<br>
			

I want the result of this $fgmembersite->PesquisarPorDatas(); in "//I want the result here" the r of my code, when the user use the "Pesquisar" button this fucntion is called but the result comes out of my css

 

any help please??

Adding Data and Join Tables

$
0
0

I have two tables 'book' and 'category'. They look like the following in phpmyadmin;

 

book

 

id   title                    author      category     isbn
---- -------                 ----------   ----------  ------- 
1    Treasure Chest     Jim Jones     1           14252637

2    Pirates Boat         Sue Smith    2           88447737

3    Adventure Land   Harry Jo      3           01918273

4    Winter Week       Sam Dill      3           00999337

5    The Twite           Roald Dahl   Fiction   87873366

 

category

 

id       cat_name   
----     -------         
1        Horror

2        Kids

3        Fiction

4        Science

 

Users have the option of adding books into the library via an online form, or via a Google Booka api method (user enters isbn, searches, is presented with book info and then clicks 'add to library', done.). This is handled via ajax.

 

The online form works fine, and successfully adds the book info.

However my problem is with the Google Books method, it successfully adds the data to the db however the category column is in text format (i.e 'Juvenile Science' or 'Scary Fiction') as opposed to the manual form which adds categories as 1, 2 or 3 (1 =Horror, 2 = Kids, 3 = Fiction).

 

Is there any way I can add the Google Book category data to my table and convert it to an integer or similar? Not sure what I need to do. Suggestions appreciated!

Should I add the Google entries to another table (i.e googleCategory)?

 

My HTML only outputs the numbered category entries and ignored the text format entries.

 

my php

$sql = "SELECT b.id, b.title, b.author, b.isbn, b.publicationYear,
        c.cat_name
        FROM book AS b
        INNER JOIN category AS c ON b.category = c.id
        WHERE status != 'Archive' ORDER BY id DESC LIMIT $startrow, 15 ";


$res = $conn->query($sql) or trigger_error($conn->error."[$sql]");


while($row = $res->fetch_array()) {


    echo '<tbody>';
    echo '<tr>';
    echo '<td>' . $row['id'] . '</td>';
    echo '<td>' . $row['title'] . '</td>';
    echo '<td>' . $row['author'] . '</td>';
    echo '<td>' . $row['cat_name'] . '</td>';
    echo '<td>' . $row['isbn'] . '</td>';
    echo '<td>' . $row['publicationYear'] . '</td>';
    echo '</tr>';
    echo '</tbody>';
};

Apologies if this is all a bit confusing I am very new to php and mysql.

Thanks,

 

J

Invalid Selection

$
0
0

How can I prevent someone from making an ivalid selection in a form? Lets say I had a select dropdown box and someone saved the HTML source from the browser, changed an item in the list, and changed the action to point back to my server eg. action="testsite.com/index.php". Then they open the file and try to submit the form.

Score Menu PHP/java

$
0
0

I am trying to create a full Scoreboard like the on the EPSN website. (The Red bar that shows the daily scores). So i created a DB called "scoreDB" I have like 30 sample scores in there.

What i want to create is a set of DIVS that will display the scores from the DB entries and refresh the scores every 10 seconds or so.

 

Righ now i can display the last score entered from the DB. But i can't make it change automaticly. So I started to think and I creted a Java scrip timer(see below) 

 

My Issue i cant figure out how to make it work

 

 

Button line i want a divs that will diplay one score at a time and refresh every 10 seconds or so and display the next available record until it shows the last 10 and start diplaying the laters entry again.  I will love to hear your sugestions or soluctions.

 

 

One DIV Sample below

 

 

<div class="score1" id="score1">
           <?php
                     
           mysql_select_db(scoredb) or die ("Couldn't not find DB");
           $query = mysql_query("SELECT * FROM results ORDER BY IDResults DESC 1 ");
    
              while($row = mysql_fetch_assoc($query))
                  {
                       $player1 = $row ["Player1"];
                       $score1 = $row ["Score1"];
                       $player2 = $row ["Player2"];
                       $score2 = $row ["Score2"];
                                        
                  
                   echo  $player1" . " " . $scr1 . " " . " " . " - " . " " . $player2" . " " . $scr2 ;
                  }
        ?>

</div>

 

<br></br>

<script type="text/javascript" src="jQuery.js"></script>
<script type="text/javascript">
   function countDown(secs, elem){
          var element = document.getElementById(elem);
         element.innerHTML = "Please wait for "+secs+" seconds";
           if(secs <1){
           clearTimeout(timer);
           element.innerHTML = '<h2>Tournament is now Open!</h2>';
           element.innerHTML += '<a href="#"> Click here now</a>';                       }
         secs--;
         var timer = setTimeout('countDown('+secs+',"'+elem+'")',1000);
   }
</script>
<div id="status"></div>
<script type="text/javascript"> countDown(10,"status");</script>


<p></p>

 

 

 

Confused

$
0
0

Hi, i'm about to start making my admin page for my site and i'm confused on if i wanted to select a user to change the password or ban them e.t.c how would i select the user? 

 

so like if i had a list of all the users on my web page i.e

 

John

Paul

Lisa 

 

how would i select one of them so i could make changes?


Condition for if to create div's with 2 different class in css.

$
0
0

Hello all

 

i have this code

<?php
$sql = "SELECT DISTINCT phonemodel FROM iphone ORDER BY phonemodel DESC LIMIT 4";
$rows = $conn->sqlExec($sql);

$nr_row = $conn->num_rows;
if($nr_row>=0) {
  $div_cls = (($nr_row % 2) == 0) ? 'linksmen' : 'linksmen_s';
  foreach($rows as $row) {
    echo '<div class="'.$div_cls.'" title="'.$row['phonemodel'].'"><a href="iphone.php?phonemodel='.$row['phonemodel'].'"><img src="images/mark.png" alt="" /> '.$row['phonemodel'].'</a></div>';
	 }
}
  ?>

And looks like,the code take only firs class (linksmen) ,the condition else not working.did someone what is wrong.

 

Thx :)

SOAP/WSDL issue with SoapClient

$
0
0

Hi y'all. I've been looking at this for two days now and my head is starting to hurt from it.

 

I'm trying to integrate with an existing web service for client log-in and having trouble getting it done and Google is being very little help at this point. Here's the code, annotated where necessary:

namespace myNamespace;

MyClass{
        private	$_apiLoginAddr = 'http://xxx.xxx.xxx.xxx:xxxx/ServiceAddress/Login.asmx?wsdl';

	public function logIn($email,$id){
/*
// these work...
		$testClient = new \SoapClient('http://www.webservicex.com/CurrencyConvertor.asmx?wsdl',array('trace'=>1,'exceptions'=>1));
		$resp = $testClient->ConversionRate(array('FromCurrency'=>'USD','ToCurrency'=>'CAD'));
		print($resp->ConversionRateResult);

		$testClientAWS = new \SoapClient('http://webservices.amazon.com/AWSECommerceService/AWSECommerceService.wsdl',array('trace'=>1,'exceptions'=>1));
		$resp = $testClientAWS->ItemLookup(array('ItemID'=>'1430260319'));
 		var_dump($resp);

		$testClientP = new \SoapClient('https://pilot.prove-uru.co.uk/URUws/uru10a.asmx?wsdl',array('trace'=>1,'execptions'=>1));
		print_r($testClientP->__getFunctions());
		die();
*/
// turning off caching because apparently it's sometimes an issue...
		ini_set('soap.wsdl_cache_enbled','0');
		ini_set('soap.wsdl_cache_ttl','0');

// this doesn't work even a little bit...
		try{
			$creds = array(
				'trace'		=>	1,
				'exceptions'	=>	1,
				'cache_wsdl'	=>	'WSDL_CACHE_NONE',
				'soap_version'	=>	SOAP_1_1,
			);
			$client = new \SoapClient($this->_apiLoginAddr,$creds);
			$results = $client->WebsiteLogin(array('_Password'=>$id,'_UserName'=>$email));

			var_dump($client->__getLastRequest());
			print('break');
			var_dump($client->__getLastResponse());

		}catch(\SoapFault $e){
			print('Exception thrown!');
			var_dump($e);
			die();
		}
		print('Succesfully completed call!');
		var_dump($results);
		die();
	}
}

Using this code, the browser churns for about a minute before I get the error "SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://xxx.xxx.xxx.xxx:xxxx/ServiceAddress/Login.asmx' : failed to load external entity "http://xxx.xxx.xxx.xxx:xxxx/ServiceAddress/Login.asmx", with or without the call to WebsiteLogin(). Now, I've also tried a non-wsdl version where I replaced the credentials array and SoapClient instantiation with the following:

try{
	$creds = array(
		'trace'		=>	1,
		'exceptions'	=>	1,
		'cache_wsdl'	=>	'WSDL_CACHE_NONE',
		'location'	=>	$this->_apiLoginAddr,
		'uri'		=>	'http://tempuri.org',
		'soap_version'	=>	SOAP_1_1,
	);
	$client = new \SoapClient(null,$creds);
        $results = $client->WebsiteLogin(array('_Password'=>$id,'_UserName'=>$email));
/* see previous code block */

Using this approach, my browser again churns for about a minute before I get the error "Could not connect to host". If I don't actually try to log in using the service's WebsiteLogin() function, SoapClient doesn't throw an error on this one and reports a successfully completed call. Which does me no good at all, because my users can't log in if I don't call the WebsiteLogin() function.

 

I can visit the end-point directly in my browser and it's definitely there and active, and SoapUI has no problem at all with the request or the response. I've tried uncommenting the open_ssl.dll in my php.ini, turning the wsdl caching options off in the php.ini directly, and pretty much everything short of ritual sacrifice to no avail.

 

My log in form is sending the credentials via AJAX to the logIn() method above, and all this is happening in a WordPress site. However, as the webservicex, webservices.amazon.com, and pilot.prove-uru.co.uk soap calls all complete successfully, I don't think that's an issue. I've spoken with the maintainer of the service gateway and he swears we're not blacklisted through the firewall, but nothing is working.

 

Anybody come across anything similar? Or have better Google skills that can actually find an applicable answer? Or have any ideas at all? 'Cause I'm at a loss...

php self to include full url

$
0
0

I am trying to include my full url on my site. example /index.php?page=demo

 

On my local server this bit of code worked fine.

 

$active = "$_SERVER[REQUEST_URI]";

 

however on my live server it returns blank, i think maybe due to the fact that its a windows server ?

 

php self works, but only returns index.php and not the full ?page=demo url

 

$active = ($_SERVER['PHP_SELF']);

 

does anyone know how i can work around this?

 

Thanks

Automatic scripting to access bank accounts for balance updates

$
0
0

Hello,

 

I designed (not coded) a finance application for windows phone 8.1 and one of the features that would be ideal is to copy your login steps in order to access your bank account automatically. Yes this does not sound safe or sane. How do I convince app users to use it? 

 

Anyway, I want this access. My rationale is that, the login information would be stored locally and if my phone was hacked then what's the loss in my login steps being hacked... they would probably be encrypted anyway but... 

 

The goal is to be able to open up a clone browser (eg. within the app) and then every step that you take, enter url, login credentials, security questions, pages accessed... the clone browser remembers and then later on as part of the app's function, it would automatically update your balances. I mean I suppose you could come up with the formulas, cash advance fees, interest rates, etc... but at the same time this doesn't seem to be a fixed thing... eg. hard to keep track and get the exact cent amount... or maybe I'm just bad at math

 

Some things in mind bitmapping, key strokes, string search, number search... 

 

Anyway scripting came to mind, not sure if php or python but 

 

Any thoughts? 

Passing object as arg to function

$
0
0
    function chk_error($site_mode, $obj)
    {
        if( $site_mode == 'dev' )
        {
            echo'Error : ('. $obj->errno .') '. $obj->error;
        }
    }

chk_error($site_mode, $stmt);

the above is not working for me.  it echos out the text but no values for errno and error.  what am i doing wrong?

I need to show data after pressing browser's back button [accidentally pressed ENTER instead of TAB]

$
0
0
not sure if this will find an answer but I am posting anyway. Any help is appreciated....my coder has left the team and no matter how I invite her to come and do some bug squashing, her new schedules won't fit a re-visit into my little aplication...I am eager to delve into the codes at my very low knowledge of php. I have initiated reading and is still trying to teach myself...but of course not as fast as the app needs the patch...here's the meat:
 
I have a form, with 20 or so info field, and get's filled-up manually from a checksheet....problem is when I accidentally press ENTER instead of TAB, it goes to incomplete info error catcher then when I press the browser's back button, all inputted data are gone.
 
Is there a way to retain the data when I press the back button....or any other solution that I can look into to resolve this dilemma?
 
again Thanks for any suggestion
 
#notyourcoderguybutmuchwillingttolearn dude
Mr. EdDLearner

php login username and password with filters

$
0
0

Hi all, 

I have been reading in almost everywhere that we should not use our own custom login and password validations ( like regex etc.) but instead use the filter_var and filter_input built in functions provided by PHP 5 and above. However even after searching for more than an hour for with different search strings, I have not found even a single example that shows how we may validate for a username/login and password in a login form. Can someone be kind enough to provide a strong secure validations for username and login.

Additionally I would also like to clarify if the username and login fields in a Login form be manipulated in any manner to pose a security threat? I mean can a hacker craft a username/login or password in such a manner as to pose an injection or any other threat?

Thanks all.


Adding link to PHPMailer email

$
0
0

I am sending emails using PHPMailer.  My configuration is below.

 

When adding a link to the message, should I use anchor tags?  Both seem to work.  What is the implication to recipients who are not using HTML email?

 

On a side note, if anything below seems wrong, please let me know.

 

Thanks

$msg='<p>Hello</p><p>Link: http://phpmailer.worxware.com/</p><p>Link: http://phpmailer.worxware.com</p><a href="http://phpmailer.worxware.com">http://phpmailer.worxware.com</a>';

$mail = new myPHPMailer(true);
$mail->AddReplyTo('myEmail@xxx.com', 'Michael Reed');
$mail->SetFrom('myEmail@xxx.com', 'Michael Reed');
$mail->AddAddress('johndoe@xxx.com', 'John Doe');
$mail->Subject = "Here is your email";
//AltBody property need not be sent since PHPMailer will create an alternate automatically
$mail->MsgHTML($message);
return ($mail->Send());
class myPHPMailer extends PHPMailer {
    public function __construct($allow_exceptions=false){
        $this->isSMTP();
        $this->SMTPDebug = 0;
        $this->Host = "smtp.gmail.com";
        $this->Port = 587;
        $this->SMTPSecure='tls';  // sets the prefix to the server.  Used for gmail only.
        $this->SMTPAuth = true;
        $this->Username = 'xxx';
        $this->Password = 'xxx';
    }
}

How to loop through a query

$
0
0

Hi

Could do with some help. I have 20 clients (client-1, client-2, client-3) and so on. Each client makes several calls per day.
How can I get a row count from two columns (Date, clid) and echo the count for each client?

How to get google chart to display

$
0
0

Good afternoon,

 

I am working on a project that gives the user a data table and a google chart (using the api) based on what the user selects for a <select> <option>.

 

Index.PHP code:

 

<form>
<select name="users" onchange="showUser(this.value);drawChart();">
<option value=""> Select a Metal: </option>
<?php
//connection details
$query = "SELECT TOP(31) tblMetalPrice.MetalSourceID, tblMetalSource.MetalSourceName from tblMetalPrice INNER JOIN tblMetalSource ON tblMetalPrice.MetalSourceID=tblMetalSource.MetalSourceID ORDER BY tblMetalPrice.DateCreated DESC ";
$result = sqlsrv_query( $conn, $query);
while( $row = sqlsrv_fetch_object ($result)) {
echo "<option value='".$row->MetalSourceID ."'>". $row->MetalSourceName ."</option>";
}
sqlsrv_close( $conn);
?>
</select>
</form>
<div id="chart_div"></div>
<div id="txtHint"><b>Past metal information will be generated below.</b></div>

this works fine and generates the list in the select option dropdown

 

Script to get table contents:

 

<script>
function showUser(str) {
  if (str=="") {
    document.getElementById("txtHint").innerHTML="";
    return;
  } 
  if (window.XMLHttpRequest) {
    // code for IE7+, Firefox, Chrome, Opera, Safari
    xmlhttp=new XMLHttpRequest();
  } else { // code for IE6, IE5
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
  xmlhttp.onreadystatechange=function() {
    if (xmlhttp.readyState==4 && xmlhttp.status==200) {
      document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
    }
  }
  xmlhttp.open("GET","scripts/gettabledata001.php?q="+str,true);
  xmlhttp.send();
}
</script>

this also works fine and generates the table contents based on 'q' value from the select dropdown. 

 

Google API script:

 

<script type="text/javascript">


  // Load the Visualization API and the piechart,table package.
  google.load('visualization', '1', {'packages':['corechart']});
  google.setOnLoadCallback(drawChart());
  
  function drawChart() {
   var jsonData = $.ajax({
          url: "scripts/getgraphdata.php",
          dataType:"json",
 data: "q="+num,
          async: false
          }).responseText;


    // Instantiate and draw our pie chart, passing in some options.
    var chart = new google.visualization.LineChart(document.getElementById('chart_div'));
      chart.draw(data, {width: 400, height: 240});
}




  </script>

getgraphdata.php script:

 

$q = intval($_GET['q']);


ini_set('display_errors',1);
ini_set('display_startup_errors',1);
error_reporting(-1);




$query ="SELECT TOP(30) tblMetalPrice.MetalSourceID, tblMetalPrice.DateCreated, tblMetalPrice.UnitPrice, tblMetalPrice.HighUnitPrice, tblMetalSource.MetalSourceName FROM tblMetalPrice INNER JOIN tblMetalSource ON tblMetalPrice.MetalSourceID = tblMetalSource.MetalSourceID WHERE tblMetalPrice.MetalSourceID = '".$q."' ORDER BY tblMetalPrice.DateCreated DESC";




$result = sqlsrv_query($conn, $query);
echo "{ \"cols\": [ {\"id\":\"\",\"label\":\"Date\",\"pattern\":\"\",\"type\":\"string\"}, {\"id\":\"\",\"label\":\"Unit Price\",\"pattern\":\"\",\"type\":\"number\"} ], \"rows\": [ ";
$total_rows = sqlsrv_num_rows($result);
$row_num = 0;
while($row = sqlsrv_fetch_object($result)){
$row_num++;
    if ($row_num == $total_rows){
      echo "{\"c\":[{\"v\":\"" . $row->DateCreated->format('d-m-Y') ."\",\"f\":null},{\"v\":" . $row->UnitPrice . ",\"f\":null}]}";
    } else {
      echo "{\"c\":[{\"v\":\"" . $row->DateCreated->format('d-m-Y') ."\",\"f\":null},{\"v\":" . $row->UnitPrice . ",\"f\":null}]}, ";
    }
}
echo " ] }";




sqlsrv_close( $conn);

When ever i try these they don't work the getgraphdata.php scripts runs fine the issue I believe but may be totally wrong may be done to the google api script that should generate the chart but doesn't.

 

Can anyone help here I've been trying to sort this for a few days now and losing confidence in myself rapidly. 

 

Thanks

 

Kris

 

Session Handling

$
0
0

Hey Guys,

Been coding PHP for a while but I always wonder about the right way of doing things. I am building an online community which I want to display to members and non-members. With this each screen will have options that are available for members only. I have set up session variables once a user logged in but its getting really old having to nest if statements on ISSET then again to check the values in the variables if it is set. See example below.

 

Question 1. Is it ok to session_start(); for all site visitors?

Question 2. If Q.1 is ok then is it ok to set all the session variables upfront with blank values as placeholders. This would eliminate the need for ISSET.

if (ISSET($_SESSION['On'])) {
	if (in_array($GroupID, $_SESSION['Groups'])) {
		$IsMember = 1;
		} 
	else {$IsMember = 0;}
	}
else {$IsMember = 0;}

Just wanted to get your  thoughts on this.

 

Thank you,

Jeremy

Problem with users

$
0
0

I have used 

$sql = "SELECT id, username FROM $tbl_name ORDER BY username";
$result = $con->query($sql);
while ($row = $result->fetch_assoc())
{
    echo "<a href='editUser.php?id={$row['id']}'>{$row['username']}</a><br><br>\n";
    echo "<style>a {color: blue; text-decoration: none;} a:hover {color: #ff0000} body {background-color: #000;} </style>";
}

in euser.php which echo's out all the users in the database via an anchor tag and includes their id in the url.

but when i click on their name i want to have options like:

- change password

- ban user

e.t.c

and i have tried 

$sql = "SELECT id FROM $tbl_name";
$result = $con->query($sql);
while ($row = $result->fetch_assoc()) {

echo "<a href='editUser.php?id={$row['id']}'> Change Password  </a>

in my other page editUser.php

it posts Change Password Change Password Change Password and each change password has the 3 ids of the users

 

this is confusing me.

Viewing all 13200 articles
Browse latest View live