473,729 Members | 2,234 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

{SOLVED} newbie - some values not passing, some are ?syntax

cassbiz
202 New Member
I have been wondering if someone can see where my error is. I have been reading a lot of different tutorials and just cannot find my error.

? Should I be using 'isset'

I can get all of the information to display but am not able to pass all of the information on to the next page just some of it. I am confused.

Expand|Select|Wrap|Line Numbers
  1. <?
  2.         include $include_path."cust_kopf.php";
  3.         include $include_path."links.php";
  4.         $andatum2 = $HTTP_GET_VARS['andatum'];
  5.         $abdatum = $HTTP_GET_VARS['abdatum'];
  6.         $zimmer = $HTTP_GET_VARS['zimmer'];
  7.         $andatum2 = $andatum;
  8.         $andatum=$_POST['andatum'];
  9.         $abdatum=$_POST['abdatum'];
  10.         $zimmer=$_POST['zimmer'];
  11. ?>
  12. <? include("$_SERVER[DOCUMENT_ROOT]/css/menu.inc"); ?>
  13. <form action="<?php echo $PHP_SELF ?>" method="post">
  14. <label>Please type in your billing Zip Code:<br />
  15. <input type="text" name="zip" />
  16. <?php
  17. while (list($name, $value) = each($HTTP_GET_VARS))
  18.   {
  19.    echo "<input type=\"hidden\" value=\"$value\" name=\"$name\">\n";
  20.   }
  21. ?>
  22. </label><br />
  23. <input type="submit" value="Get City and State" />
  24. </form>
  25. <?
  26.  $zip = $_POST['zip'];
  27.      $city=$_POST['city'];
  28.         $plz=$_POST['zip'];
  29.         $stadt=$_POST['state'];
  30. $sql = ("SELECT zip, city, state FROM zip WHERE zip='$zip'");
  31.  echo '<p>Zip Code:</p>';
  32.  // Request Zip Code Information
  33.  $result = @mysql_query($sql);
  34.  if (!$result) {
  35.    echo('<p>Error performing query: ' .   mysql_error() . '</p>');
  36.    echo $sql;
  37.    exit();
  38.  }
  39.  // Display the text of zip in a paragraph
  40.  while ($row = mysql_fetch_array($result)) {
  41.  if ($zip == 0) {
  42.  echo "<p> Please enter your Zip Code in the above box or press the continue button to manually enter your information</p>";
  43.         }
  44. else {
  45.  echo "<p> Your billing Zip Code is <b>{$row['zip']}</b> which is located in <b>{$row['city']},   {$row['state']}</b>.  Please press the continue button to enter your information.</p>";
  46.  }
  47.  }
  48.  $row['zip'] = $plz;
  49.  $stadt=$row['state'];
  50.  $city=$row['city'];
  51.   echo '<a href="cust_card.php?andatum='.$andatum.'&abdatum='.$abdatum.'&plz='.$plz.'&city='.$city.'&stadt='.$stadt.'&zimmer='.$zimmer.'&eingabe=1'.'">Continue to enter address</a>';
  52. ?>
  53.  
  54.  
The last line contains all of the information except for $stadt & $city.

Thanks in advance.
Nov 2 '06 #1
7 1379
ronverdonk
4,258 Recognized Expert Specialist
It would help if you tell us what the error is you run into. Now we have to guess!

(by the way: don't use HTTP_GET_VARS because it is deprecated and is gone in PHP6, use $_GET instead.)

Ronald :cool:
Nov 2 '06 #2
cassbiz
202 New Member
On the last link to cust_card.php (end of code), all of the values are retrieved and put into the string except for stadt and city. Though they show up initially when you run the first part of the script.


It would help if you tell us what the error is you run into. Now we have to guess!

(by the way: don't use HTTP_GET_VARS because it is deprecated and is gone in PHP6, use $_GET instead.)

Ronald :cool:
Nov 2 '06 #3
cassbiz
202 New Member
On the last link to cust_card.php (end of code), all of the values are retrieved and put into the string except for stadt and city. Though they show up initially when you run the first part of the script.
Below is an example of the output.

Expand|Select|Wrap|Line Numbers
  1. ./cust_card.php?andatum=1162573200&abdatum=1162616400&plz=97526&city=&stadt=&zimmer=Space%202&eingabe=1
  2.  
Nov 2 '06 #4
cassbiz
202 New Member
I cleaned up the code to get rid of the "$HTTP_GET_VARS "

The output string is on line 54 and it is not retrieving all of the values. The only ttwo that are not showing is 'city' and 'stadt'.

Expand|Select|Wrap|Line Numbers
  1. <?
  2.         include $include_path."cust_kopf.php";
  3.         include $include_path."links.php";
  4.         $andatum2 = $_GET['andatum'];
  5.         $abdatum = $_GET['abdatum'];
  6.         $zimmer = $_GET['zimmer'];
  7.         $andatum2 = $andatum;
  8.         $andatum=$_POST['andatum'];
  9.         $abdatum=$_POST['abdatum'];
  10.         $zimmer=$_POST['zimmer'];
  11. ?>
  12. <form action="<?php echo $PHP_SELF ?>" method="post">
  13. <label>Please type in your billing Zip Code:<br />
  14. <input type="text" name="zip" />
  15. <?php
  16. while (list($name, $value) = each($_GET))
  17.   {
  18.    echo "<input type=\"hidden\" value=\"$value\" name=\"$name\">\n";
  19.   }
  20. ?>
  21. </label><br />
  22. <input type="submit" value="Get City and State" />
  23. </form>
  24. <?
  25.  $zip = $_POST['zip'];
  26.         $city=$_POST['city'];
  27.         $plz=$_POST['zip'];
  28.         $stadt=$_POST['state'];
  29. $sql = ("SELECT zip, city, state FROM zip WHERE zip='$zip'");
  30.  echo '<p>Zip Code:</p>';
  31.  // Request Zip Code Information
  32.  $result = @mysql_query($sql);
  33.  if (!$result) {
  34. //   exit('<p>Error performing query: ' .   mysql_error() . '</p>');
  35.    echo('<p>Error performing query: ' .   mysql_error() . '</p>');
  36.    echo $sql;
  37.    exit();
  38.  }
  39.  // Display the text of zip in a paragraph
  40.  while ($row = mysql_fetch_array($result)) {
  41.  if ($zip == 0) {
  42.  echo "<p> Please enter your Zip Code in the above box or press the continue button to manually enter your information</p>";
  43.         }
  44. else {
  45.  echo "<p> Your billing Zip Code is <b>{$row['zip']}</b> which is located in <b>{$row['city']},   {$row['state']}</b>.  Please press the continue button to enter your information.</p>";
  46.  }
  47.  }
  48.  $row['zip'] = $plz;
  49. // $row['city'] = $city;
  50. // $row['state'] = $stadt;
  51.  $stadt=$row['state'];
  52.  $city=$row['city'];
  53.  
  54.   echo '<a href="cust_card.php?andatum='.$andatum.'&abdatum='.$abdatum.'&plz='.$plz.'&city='.$city.'&stadt='.$stadt.'&zimmer='.$zimmer.'&eingabe=1'.'">Continue to enter address</a>';
  55. ?>
  56.  
  57.  
Nov 3 '06 #5
ronverdonk
4,258 Recognized Expert Specialist
When you have a url string and you don't know if there are any funny characters or blanks in it, you better use the url encode function, so:
Expand|Select|Wrap|Line Numbers
  1. $url = "?andatum=$andatum&abdatum=$abdatum&plz=$plz&city=$city&stadt=$stadt&zimmer=$zimmer&eingabe=1";
  2. $url = urlencode($url);
  3. echo "<a href='cust_card.php$url'>Continue to enter address</a>";
Ronald :cool:
Nov 3 '06 #6
cassbiz
202 New Member
I put that the urlencode in and the output is now

Expand|Select|Wrap|Line Numbers
  1. cust_kartei.php%3Fandatum%3D1162573200%26abdatum%3D1162616400%26plz%3D97526%26city%3D%26stadt%3D%26zimmer%3DSpace+2%26eingabe%3D1
no longer using the "&"

Still back to the same problem. In that final string, the city and stadt variables are not carrying over.


When you have a url string and you don't know if there are any funny characters or blanks in it, you better use the url encode function, so:
Expand|Select|Wrap|Line Numbers
  1. $url = "?andatum=$andatum&abdatum=$abdatum&plz=$plz&city=$city&stadt=$stadt&zimmer=$zimmer&eingabe=1";
  2. $url = urlencode($url);
  3. echo "<a href='cust_card.php$url'>Continue to enter address</a>";
Ronald :cool:
Nov 3 '06 #7
cassbiz
202 New Member
The fix for the error that I had was to enter in the $stadt and $city right below the 'echo' for the output.

Expand|Select|Wrap|Line Numbers
  1.  echo "<p> Your billing Zip Code is <b>{$row['zip']}</b> which is located in <b>{$row['city']},   {$row['state']}</b>.  Please press the continue button to enter your information.</p>";
  2.  $stadt=$row['state'];
  3.  $city=$row['city'];
  4.  
Again, I want to thank everyone who helped.
Nov 7 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
79137
by: Ralph Freshour | last post by:
I'm trying to dynamically load a .jpg image into a html form <Img tag using a PHP variable that holds the filename of the image but no image is displaying (the file is there and works because if I manually type in the filename the <Img tag works) - how can I get PHP's variable to be seen as the filename? Thanks... <?php print '<IMG SRC="$php_photo2_file" WIDTH="268" HEIGHT="176" BORDER="0"
66
5013
by: Darren Dale | last post by:
Hello, def test(data): i = ? This is the line I have trouble with if i==1: return data else: return data a,b,c,d = test()
0
1220
by: Tom Petersen | last post by:
I have this code taken from a website that works fine: <%@ Page Language="vb" ContentType="text/html" ResponseEncoding="iso-8859-1" Debug="False" trace="False"%> <%@ import Namespace="System.IO" %> <script runat="server"> Sub Page_Load(Sender As Object, E As EventArgs)
3
2245
by: trickish | last post by:
In my main I try to get values assigned to "int *thisSoduko" through the static method Reader::read. int main(char *args) { ... int *thisSoduko = new int; if(Reader::read( fileName, delimiter, thisSoduko, size)) { std::cout << size;
12
6899
by: Dennis D. | last post by:
Hello: I want a function to return three variables to the calling procedure: Private Function CalcTimes(ByVal iAddDays as Integer, ByVal iAddHours as Integer, ByVal iAddMins as Integer) As Array Variable values are calculated in the function. Calling procedure receives the values preferably into variables of the same
0
973
by: Syd_Man | last post by:
I have a Gridview that is passing value to a detailsview controls using DefaultValue="EmployeeID = {0}" syntax however if I use the same syntax for the Integer it raises some Conversion error. What is the syntax to use the same method to pass Integer values to detailsview? SelectParameters>
5
1678
by: sparks | last post by:
I was using this to add a record to a table but the systax is messing me up. strSQL = "INSERT INTO TblChallengeRECESS ( childname, teacher, kidid, formdate) " & _ "VALUES (me.childname.column(0)," & _ "me.teacher.column(0), me.kidID, " & _ "#" & Me.formdate & "#);"
13
2341
by: JBuckland | last post by:
Im trying to create a 7 segment display for a project in visual basic 2005 express edition. I have a 2 dimentional boolean which stores the values of each of the segments for a certain display. I have written a case statement for the first display and would like to use it for the other displays instead of having to copy the code. I have tried everything I can think of but can't get it to pass the name of the boolean array im trying to set the...
10
1047
by: mcl | last post by:
Why can I not the change the value of a variable in another class, when I have passed it via a parameter list. I am sure I am being stupid, but I thought passed objects were Read/ Write eg ------------------------------------------------------------ #!/usr/bin/python
3
3371
by: MM | last post by:
Hi to all, I'm trying to import a tab separated values file onto Excel with the following script: import csv from pyExcelerator import * w = Workbook() worksheet = w.add_sheet('sim1')
0
8913
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8761
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9426
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9280
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9200
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9142
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8144
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
2
2677
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2162
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.