parsing value via hyperlink using document.form.submit()

Discussion in 'JavaScript' started by arrezes, Sep 14, 2009.

  1. #1
    please help me!

    i'm parsing these value from a form

    $_POST['acc_no']
    $_POST['acc_holder']
    $_POST['amount']

    to a page, say receive.php

    all the parsed data will be sent to text boxes in a form

    receive.php:
    
    	
    	function sendAcc(accno)
    	{
    		window.location.href = "receive.php?accno="+accno;
                    document.form1.submit();
            }
    
    Code (markup):
    this is the body content
    
    <body>
    	<form name="form1" method="post" action="receive.php">
    		<input type="text" name="acc_no" value="<?php echo $_POST['acc_no']">
    		<input type="text" name="acc_holder" value="<?php echo $_POST['acc_holder']" >
    		<input type="text" name="amount" value="<?php echo $_POST['amount']" >
    	</form> 
    
    Code (markup):
    the form will post the value to the same page

    this is the code for the link
    
            <a href="receive.php" onClick="sendAcc(<script> document.form1.acc_no.value</script>)">Get Details</a>
    
    Code (markup):

     
    arrezes, Sep 14, 2009 IP
  2. prasanthmj

    prasanthmj Member

    Messages:
    62
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    45
    #2
    Your question is very vague. More over, the code for receive.php: seems like JavaScript code. Post more details and you might get better answer
     
    prasanthmj, Sep 14, 2009 IP
  3. arrezes

    arrezes Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    my idea is like this

    i have this table in receive.php after getting
    $_POST['acc_no']
    $_POST['acc_holder']
    $_POST['amount']
    from a page. using these data I am able to get this table querying it from MySQL database

    | Account No | Holder Name | Amount |
    | 2331 | John Doe | $400 |
    | 2332 | Amanda Jack| $350 |
    | 2333 | Ahmed Rio | $700 |
    | 2334 | Mary Jane | $640 |

    I want the title on each column to be a hyperlink so that user able to click on each column title and sort the data accordingly.

    Eg. When a user click on holder name receive.php will sort the data in the table like this

    | Account No | Holder Name | Amount |
    | 2333 | Ahmed Rio | $700 |
    | 2332 | Amanda Jack| $350 |
    | 2331 | John Doe | $400 |
    | 2334 | Mary Jane | $640 |

    and if the user want to sort by Amount just click the title Amount

    does my code possible to get this done?
     
    Last edited: Sep 14, 2009
    arrezes, Sep 14, 2009 IP
  4. Mastermaniac

    Mastermaniac Peon

    Messages:
    128
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I think..

    You must just remove the <script> tags!
     
    Mastermaniac, Sep 19, 2009 IP