473,394 Members | 1,693 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.

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

cassbiz
202 100+
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 1366
ronverdonk
4,258 Expert 4TB
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 100+
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 100+
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 100+
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 Expert 4TB
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 100+
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 100+
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
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...
66
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
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"...
3
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,...
12
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...
0
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. ...
5
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...
13
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...
10
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...
3
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
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
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.