473,394 Members | 1,866 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Cant Get posted value

flexsingh
Hello there, I have constructed a option of choosing a court only available when member no = "0". This works fine and is in the first code: -

[PHP]<html>
<head>
</head>

<body background="main background1.jpg" link="blue" vlink="blue">

<table width="350" border="1" align="center" cellpadding="0" cellspacing="1">
<tr>
<td><form name="Update Network Gaming form" method="post" action="updatebcourt_ac.php">
<table width="100%" border="1" cellspacing="1" cellpadding="3">
<tr>
<td colspan="3" align="center"><strong><font face="sans-serif, Arial" font color="white">Insert Data Into mySQL Database </strong></td>
</tr>
<tr>
<td><font face="sans-serif, Arial" font color="white">Member No</td>
<td><font color="white">:</td>
<td><input name="Member_No" type="int" id="Member_No"></td>
</tr>
<tr>
<td><font face="sans-serif, Arial" font color="white">Court No</td>
<td><font color="white">:</td>
<td><input name="Court_No" type="varchar" id="Court_No" value="Bcourt"></td>
</tr>

<tr>
<td><font face="sans-serif, Arial" font color="white">Time Slot No</td>
<td><font color="white">:</td>
<td><select>

<?php
$db_name="project"; // Database name
$tbl_name="bcourt"; // Table name

// Connect to server and select database.
$conn = mysql_connect($_SESSION['host'], $_SESSION['username'], $_SESSION['password'])or die("cannot connect");
mysql_select_db("$db_name", $conn)or die("cannot select DB");

$time=urlencode($_GET['Time_Slot_No']);

$time = "SELECT Time_Slot_No FROM $tbl_name WHERE Member_No = '0'";
$query = mysql_query($time, $conn); // do the query
while($queryColumn=mysql_fetch_assoc($query)){ // fetch each row in the result set
$val=$queryColumn['Time_Slot_No']; // make it simpler
echo "<option value='$val'>$val</option>"; // construct option statement
}
?>
</select></td>
</tr>

<td colspan="3" align="center"><input type="submit" name="Submit" value="Continue"></td>
</tr>
</table>
</form>
</td>
</tr>
</table>



</body>
</html>[/PHP]

It then sends the data to be updated into the table replacing the member number "0" to whatever was put in.

The problem I am getting is it can't update any time slot as it cant retieve the slot I asked for. It only updates member = "0".

[PHP]<?php
// this starts the session
session_start();
?>

<?php
$db_name="project"; // Database name
$tbl_name="bcourt"; // Table name

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

// Get values from form
$memberno1=$_POST['Member_No'];
$courtno1=$_POST['Court_No'];
$TSN1=$_POST['Time_Slot_No'];

$time=urldecode($_GET['Time_Slot_No']);

// Insert data into mysql
$query = ("UPDATE $tbl_name SET Member_No = '$memberno1' WHERE Time_Slot_No = '".$_GET['Time_Slot_No']."' LIMIT 1");
$result=mysql_query($query) or die(mysql_error());

// if successfully insert data into database, displays message "Successful".
if($result){
echo $query;
}
else {
echo "Cannot Update";
}
// close connection
mysql_close();
?>[/PHP]

I had asked for a echo query and it shows : -
"UPDATE bcourt SET Member_No = '3' WHERE Time_Slot_No = '' LIMIT 1"

So I know it can't find the time slot, can anyone help me please.

Thank you in advanced forany help.
Mar 30 '08 #1
6 1942
ronverdonk
4,258 Expert 4TB
Your <form> is posted, [php]<td><form name="Update Network Gaming form" method="post" action="updatebcourt_ac.php">[/php]then why do you retrieve the passed value from the $_GET array?[php]$query = ("UPDATE $tbl_name SET Member_No = '$memberno1' WHERE Time_Slot_No = '".$_GET['Time_Slot_No']."' LIMIT 1");[/php]Ronald
Mar 30 '08 #2
Your <form> is posted, [php]<td><form name="Update Network Gaming form" method="post" action="updatebcourt_ac.php">[/php]then why do you retrieve the passed value from the $_GET array?[php]$query = ("UPDATE $tbl_name SET Member_No = '$memberno1' WHERE Time_Slot_No = '".$_GET['Time_Slot_No']."' LIMIT 1");[/php]Ronald

Id need to retrieve the past value so it knowns which time slot to update the member no for. That is why I'm getting the value (time_Slot_No".
Mar 30 '08 #3
ronverdonk
4,258 Expert 4TB
Guess you don''t know what I am talking about.
When you POST a value, you cannot retrieve it from the $_GET array, you must retrieve it from the $_POST array!

Ronald
Mar 30 '08 #4
Guess you don''t know what I am talking about.
When you POST a value, you cannot retrieve it from the $_GET array, you must retrieve it from the $_POST array!

Ronald
I understand now thank you, it works fine. Would you like me to post the working code up for any other users stuck to see?

Thank you very much for your help!
Mar 31 '08 #5
Markus
6,050 Expert 4TB
I understand now thank you, it works fine. Would you like me to post the working code up for any other users stuck to see?

Thank you very much for your help!
I think Ron's last post sums it up.

Regards :)
Mar 31 '08 #6
ronverdonk
4,258 Expert 4TB
I understand now thank you, it works fine. Would you like me to post the working code up for any other users stuck to see?

Thank you very much for your help!
No, I think we get the idea. But I am glad you worked it out. See you around.

Ronald
Mar 31 '08 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Fozya | last post by:
Hi, I have problems compiling some code that perfectly runs in VS.Net in the G++. Here is what I got: MyClass a; MyClass b; //assign values to a and b .......
0
by: Tony Williams | last post by:
I have posted a number of posts in the Access newsgroups concerning my problem with DLookup. I have had a number of the experts with helpful suggestions but I still can't get it to work! This is...
9
by: Dan K. | last post by:
Hi Folks, Problem is, that on one of my controls the DEL key wont work in textboxes. i have different controls of this kind in my app and this is the only one the DEL Key wont do his job....
7
by: Mike Fellows | last post by:
Below is my code that is carried out on my dataset, datagrid etc... Im trying to get column0 "Date & Time" to show date and time, not just date ive read some stuff posted by Dmitriy Lapshin on...
16
by: Mike Fellows | last post by:
when i load my windows form i populate a combobox i use the code below Dim conn As New System.Data.SqlClient.SqlConnection(strConn) Dim sql As String = "AllLenders" Dim da As New...
0
by: riteshraha | last post by:
Hi everyone, I am a member of this forum. i have posted my problem repeatedly to this forum. but i cant get any reply from this forum. plz anyone make any reply of my problem. I cant retrieve...
19
by: bb nicole | last post by:
Below is my search engine for job portal which jobseeker can find the job through quick search. But it cant work... Is it mysql query got problem?? Thanx.. Interface <html> <head> <title>UMS...
2
by: moondaddy | last post by:
I had to repost this because I had to update and change my msdn alias. I will re-ask the question and clarify a few things that were not clear before. This code is all executed on my dev...
66
by: happyse27 | last post by:
Hi All, my html code is sno 1) and perl code is sno 2). a) I tried to print $filename and it cant print out the value, only blank was displayed, and the file could not be uploaded. And it...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.