Current location: Hot Scripts Forums » Programming Languages » PHP » passing a value from one form to another


passing a value from one form to another

Reply
  #1 (permalink)  
Old 09-01-10, 06:26 AM
esandra esandra is offline
Newbie Coder
 
Join Date: Aug 2009
Posts: 47
Thanks: 1
Thanked 0 Times in 0 Posts
passing a value from one form to another

//i've been looking at this same code for two whole days now and ive changed it lots of times but it can only get worse
//i can't pass the value of the variable $today which has a date datatype
//this is the part where i get the value of $today
PHP Code:

 <?php 
           $query
="SELECT DISTINCT date FROM arrastre order by today desc";
           
$result=mysql_query($query);
           while(
$row=mysql_fetch_object($result)){
                   
$today=$row->today;    
            echo 
"<option value=$today>$today</option>";
           }
           
?>
//here's is the part where i use $today to get $tcl
//except for a major problem that when the while loop returns more than one $tcl, i get more than one button, but that's not the problem because that is how it's supposed to work. The problem is that when there are more than one buttons, only the last button would work, the only button that displays values
PHP Code:

 <?php 
        
if(isset($_POST['godate'])){
            
$today=$_POST['today'];
            
$query="SELECT DISTINCT tcl FROM arrastre WHERE today='$today' ORDER BY tcl ASC";
            
$result=mysql_query($query);
            while(
$row=mysql_fetch_array($result)){
                
$tcl=$row['tcl'];
                
$today=$row['today'];
                
?>
                <input type="hidden" name="tcl" value="<?php echo $tcl;?>">
                <input type=submit name="tcl" value="<?php echo $tcl?>">
        <?php        } }
        
?>
//thsi is another problem
PHP Code:

if(isset($_POST['tcl'])){    
            
$tcl=$_POST['tcl'];
            
$today=$_POST['today'];
            
$query "select * from arrastre where tcl=$tcl and today='$today' order by tcl asc";
            
$result mysql_query($query);
            
$totalcollections 0;
            while(
$row=mysql_fetch_array($result)){
                
$orno=$row['orno'];
                
$billnmbr=$row['billnmbr'];
                
$payor=$row['payor'];
                
$arrastre=$row['arrastre'];
                
$wharfage=$row['wharfage'];
                
$total=$row['total'];
                
$today=$row['today'];
//*i deleted the display part to make this shorter a little
}} 
//the $today variable is empty in this post and i have no idea how to successfully pass this value
so i could use it in my $query
//thanks for your time

Last edited by UnrealEd; 09-01-10 at 11:31 AM. Reason: fixed [php] tags
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 09-01-10, 08:06 AM
omkarvjoshi1982 omkarvjoshi1982 is offline
New Member
 
Join Date: Sep 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
echo "<option value=$today>$today</option>";
instead of using the above method try to use following method
echo "<option value='".$today."'>$today</option>";
--------------------------------------------------------------------
<input type=submit name="tcl" value="<?php echo $tcl; ?>">
instead of using the above method try to use following method
<input type=submit name="tcl[ ]" value="<?php echo $tcl; ?>"> // this will give you an array named tcl
--------------------------------------------------------------------

instead of accessing today named variable try to access <select name='what_ever_name_you_have_given'>

this will give you the exact date
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 09-01-10, 08:32 AM
esandra esandra is offline
Newbie Coder
 
Join Date: Aug 2009
Posts: 47
Thanks: 1
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by omkarvjoshi1982 View Post
echo "<option value=$today>$today</option>";
instead of using the above method try to use following method
echo "<option value='".$today."'>$today</option>";
--------------------------------------------------------------------
<input type=submit name="tcl" value="<?php echo $tcl; ?>">
instead of using the above method try to use following method
<input type=submit name="tcl[ ]" value="<?php echo $tcl; ?>"> // this will give you an array named tcl
--------------------------------------------------------------------

instead of accessing today named variable try to access <select name='what_ever_name_you_have_given'>

this will give you the exact date
Thank you,
i don't have an idea how to use the value of tcl from this line
<input type=submit name="tcl[ ]" value="<?php echo $tcl; ?>">
since im going to call its value in my last query..it returns an error upon calling my query because its an array
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Space Above Form xavier039 CSS 1 07-13-09 11:52 PM
ajax checking and onsubmit issue follower JavaScript 4 10-12-08 04:45 PM
Passing results of a form select to another form?? NCC1701 PHP 1 04-29-04 12:54 PM
Passing value from one form to another form sunilmzp ASP.NET 0 04-05-04 05:02 AM
Passing value from one form to another form sasi ASP 2 08-30-03 12:38 AM


All times are GMT -5. The time now is 04:03 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.