Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP How-To
|
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 11th, 2004, 04:47 AM
Authorized User
 
Join Date: Jan 2004
Posts: 33
Thanks: 0
Thanked 0 Times in 0 Posts
Default passing data and substr...HELP!!!!!!!!!!!!

i have a problem here..
i have a submit form...with textboxes and a combobox...
the combobox contains a list of ID's like A1,B1 and C1...
let say i select A1 and click submit...

then the second form appear...
FYI,at the earlier submit form,i did a substr function after select the A1...
i want to cut only the "A"...
the purpose is at the second page,the A from the substr,will be used...
the second page contains a combobox with list of ID's like A2,A3,B2,B3...
so,when i choose A1 from the submit page,the combobox at the second page will allow me to choose only IDs starting with A...and same with B1 or C1..

and i have problem at the second page..
the combobox has nothing to choose...
i wonder whats wrong...

how to do this?
i mean how to do a substr at the first page,and then use the cut item to compare it with the other item at the second page?

substr(let say A)-->post to 2nd page-->use the A to display records starting with A only

do u understand what i'm trying to do?
sorry for my bad english...
i'm trying to talk here...


i wanna do substr to item taken from mysql...
heres my code snippet...

at the submit page..
Code:
//----------------------------------------------------

   $query2 = "Select idMajor from ".$DBprefix." tPartMinor where idmajor <>'' group by idmajor order by idmajor";
   $mesin = mysql_query($query2);
         while ($dbq = mysql_fetch_array($mesin)) {
         echo("<OPTION VALUE=$dbq[idMajor] selected>$dbq[idMajor]</option>\n");
         $ayam=$dbq[idMajor];
         $depan=substr("$ayam",0,1);
                  }
?>
          </select>
      </td>
    </tr>
  </table>
  <br><br>
  <center>

   <input type="hidden" name="ID" value="<?=$referNum?>">
   <input type="hidden" name="hariIni" value="<?=$datToday?>">
   <input type="hidden" name="front" value="<?=$depan?>">
at the second page..i use the cut item from the substr function earlier...

Code:
$minor=@$HTTP_POST_VARS["front"];
.
.
.
.
. <select name="idMinor" size="1">
          <option value="0">ID Minor</option>
        <?php
   //----------------------------------------------------
   //          Access Data From MySQL
   //          TABLE : tPartMinor
   //----------------------------------------------------
   $query2 = "Select LEFT('idMinor',0) from ".$DBprefix." tPartMinor where LEFT('idMinor',0)='$minor'";
   $result2 = mysql_query($query2);
         while ($dbq2 = mysql_fetch_array($result2)) {
         echo("<OPTION VALUE=$dbq2[idMinor] selected>$dbq2[idMinor]</option>\n");
      }
?>
    </select>
but it seems i failed to do that...
what is the problem?
how to fix my code?pls help!!!!!!!!!!!!

 
Old January 11th, 2004, 01:05 PM
richard.york's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

Cross-post with topic:
http://p2p.wrox.com/topic.asp?TOPIC_ID=8284

Please post replies there!

:::::::::::::::::::::::::::::::::
Smiling Souls
http://www.smilingsouls.net
:::::::::::::::::::::::::::::::::





Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing data between forms pactite Access 5 June 4th, 2005 03:02 PM
passing data texasraven HTML Code Clinic 0 March 3rd, 2004 05:03 PM
substr from query apek PHP How-To 13 January 13th, 2004 04:16 AM
Passing URL data Brian_S Dreamweaver (all versions) 2 December 1st, 2003 08:22 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.