SunQuest
 
           PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
  #1  
Old January 30th, 2004, 04:39 AM
surfie35 surfie35 is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 6 surfie35 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Will this code get the user selected var and make it available to another php page?

Im trying to get this list to post the variable "id" so that my popflag3.php page can insert the var into sql query string. Will this code post the var? pls let me know what i should use if i dont want to use sessions or cookies.

<form name="country" method="post" action="popflag3.php">
<p align="left"><font color="#FF0000" face="Arial, Helvetica, sans-serif">
</font></p>
<p align="left"><font color="#FF0000" face="Arial, Helvetica, sans-serif">
<SELECT NAME="id" SIZE="1" class="ddlist">

<option value="1">Australia</option>
<option value="3">Austria</option>
<option value="2">Algeria </option>
<option value="4">Antigua </option>
<option value="5">Barbados</option>
<option value="6">China</option>
<option value="7">Denmark</option>
<option value="8">England</option>
<option value="9">Finland</option>
<option value="10">Ghana</option>
<option value="11">India</option>
<option value="12">Jamaica</option>

</select>

<?php $HTTP_POST_VARS[$id]); ?>

</form>

-------------------------------------------------------------------------
The other page, popflag3.php looks like this

<?
$username = "username";
$password = "password";
$hostname = "db.synth.com";
$db_connect = mysql_connect($hostname, $username, $password)
or die("Unable to connect to MySQL");
$db_select = mysql_select_db("flags", $db_connect)or die("Unable to select flags");


$query= "SELECT * FROM data WHERE id = $HTTP_POST_VARS['$id']" ;

$result = mysql_query("SELECT * FROM data WHERE id = $HTTP_POST_VARS['$id']") or die(mysql_error());

while($row = mysql_fetch_array($result)){


$country=$row['country'];


$flaglink=$row['flaglink'];

$mobrate=$row['mobrate'];

$landrate=$row['landrate'];

echo "<tr>
<td>
$country
</td>
<td>
$mobrate
</td>
<td>
$landrate
</td>
<td>
<img src=\"$link\">
</td>
</tr>";
}
?>
The query works fine with a static value such as if i hardcode id=1 in the query.
If i try to insert the variable $id from the user selected value in the previous page using SELECT * FROM data WHERE id = $HTTP_POST_VARS['$id']" ;
i get nothing...no errors but no results either. What am i doing wrong??
Thanks for your help
surfie35

Reply With Quote
  #2  
Old January 30th, 2004, 06:45 AM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to dhouston
In the first page, rather than just printing out the id, you need to print it out as the value for a hidden field named id.

Reply With Quote
  #3  
Old January 30th, 2004, 06:50 AM
surfie35 surfie35 is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 6 surfie35 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Quote:
Originally posted by dhouston
In the first page, rather than just printing out the id, you need to print it out as the value for a hidden field named id.


Just add a hidden field called id and set the value of that field to $id?

pls can i ave the exact code to do that?

thanks

Reply With Quote
  #4  
Old January 30th, 2004, 07:37 AM
surfie35 surfie35 is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 6 surfie35 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
i tried this...but i cant get the var id to print on the next page
<input name="id" type="hidden" value="$id">
not working

Reply With Quote
  #5  
Old January 30th, 2004, 08:11 AM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to dhouston
Code:
<input type="hidden" name="id" value="<?php echo $_POST["id"]; ?>">

Reply With Quote
  #6  
Old January 30th, 2004, 08:26 AM
surfie35 surfie35 is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 6 surfie35 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
thanks a whole bunch
will
$query= ("SELECT * FROM data WHERE id= '$id'")
substitute the variable value in the query??
i think my query looks ok, pls advise, and thank u again for ur prompt replies..
kris

Reply With Quote
  #7  
Old January 30th, 2004, 08:30 AM
surfie35 surfie35 is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 6 surfie35 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
im using this line to get the var value

$id= $_GET['$id'];

the using in the query...
$query= ("SELECT * FROM data WHERE id= '$id'") ;

have i got all the quotes and brackets corrct,
many thanks

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > Will this code get the user selected var and make it available to another php page?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Iron Speed




© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway