$_POST variable un-useable


Posted on 16th Feb 2014 07:03 pm by admin

I'm trying to use a $_POST variable in a mysql update statement but i can't use it for some unknown reason i can echo the variable and it outputs the correct value but i cannot use that variable in anyway in the mysql update statement here is the whole page.Thankyou for your time.

Code: <?php session_start(); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Model login</title>
<META name="keywords" content="webcam, webcams, cam, cams, live, girls, free, video, women,
lesbians, porn, porno, teen, teens, men, guys, nude, private, pussy, sexy, webcam, camgirls,
home cams, video chat, free video, teen, sex, xxx, adult, age ,naked">
<META name="robots" content="index,follow">
<META name="revisit-after" content="10">
<META name="robots" content="all">
<meta name="author" content="root">
<META name="page-topic" content="live sexy web cams and chat">
<META name="copyright" content="privatechatnow.com,2009">
<META name="distribution" content="global">
<META name="ABSTRACT" CONTENT="Privatechatnow.com - Live video cam and chat">
<META name="rating" content="Mature">

<?php
include("../secure_php/admin_database.php");


//exchange 3 with 1
//$oldnum =3;
//$newnum =1;

if(isset($_POST['exchange'])){
$oldnum =$_POST['oldnum'];
$newnum =$_POST['newnum'];


$current1 = Array();
$currsel1 = mysql_query("select id from page0.page0 where refnum ='$oldnum' AND username!='admin'")
or die(mysql_error());
while($currrow1 = mysql_fetch_array($currsel1)){
array_push($current1,$currrow1['id']);
}
print_r($current1);



$test = $current1[0];

$upref11= mysql_query("update page0.page0 SET refnum='$oldnum' where id='$test'")
or die(mysql_error());
}



?>
</head>
<body >


<form action="" method="POST">
<table align="left" border="0" cellspacing="0" cellpadding="3">
<?php
$_SESSION['refnum0'] = $_POST['oldnum'];


$_SESSION['refnum1'] = $_POST['newnum'];

?>
<tr><td>Old RefNum:</td><td><input type="text" name="oldnum" maxlength="4" width= "30"value ="<?php if(isset ($_SESSION['refnum0'])){echo $_SESSION['refnum0'];}?>"> </td></tr>
<tr><td>New RefNum:</td><td><input type="text" name="newnum" maxlength="4"value ="<?php if(isset ($_SESSION['refnum1'])){ echo $_SESSION['refnum1'];}?>"></td></tr>
<tr><td colspan="2" align="right"><input type="submit" name="exchange" value="Change"></td></tr>
</table>
</form>
</body>
</html>





























No comments posted yet

Your Answer:

Login to answer
122 Like 36 Dislike
Previous forums Next forums
Other forums

Add trigger to UpdatePanel programmatically
Hi,I'm working on a website which uses AJAX and Masterpages. What I have is an AJAX UpdatePanel whi

php forms and database navigatio
Hello,
I'm new to php and i'd like to post the following.
I have written code to get records f

update post issues
I am trying to create an update to a post function, while the update does occur, the page routing an

Can php detect connection speed and thereafter swap out elements?
No code to post, lads, yet. Just looking for a yay or nay at this stage:

Can a php script be

Socket problem
Hello,

Earlier I posted about my problem with my socket script. It took up to 100% CPU usage.

Coding Critique
I was hoping someone could take a second and look down my code and see if they see any problems with

md5 is it unique
I know this is most likely one of many simple questions that can be found semi easily. But I'm press

Problem in OnClientClick and OnClick sync
Hi,Strange and irritating problem: I have below button declaration in markup of the aspx page:

Procedural to OOP
ohn Kleijn said that to avoid writing "crappy code", we should learn OOP and common OO pri

help with database debug pls
Parse error: syntax error, unexpected T_ELSE in /home/content/m/e/s/mesick/html/students/05/php/chec

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash