Jump to content

need help with passing variables via ahref link


rsammy

Recommended Posts

i am working on an email module as part of a patient application. i need to post some date variables/parameters via one of the ahref links on the screen.

my code for this bit is here...

<tr>
<td> <div align="left">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src="images/selectedfolder-icon.gif"
         width="16" height="13">Inbox </div></td>
</tr>
<tr>
 <td> <div align="left">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src="images/selectedfolder-icon.gif"
         width="16" height="13">Sent Items </div></td>
</tr>
<tr>
<td> <div align="left">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src="images/compose-button.gif"  
         width="21" height="15"><a href="compose.php">Compose</a></div></td>
</tr>

in the above code, i need to pass some variables via the Compose ahref link. how do i do that?

i am looking for something similar to ...

<tr>
<td><a href="view.php<?PHP
            print("?mess_id=".$rowz["ID"]. "&m1=".$m1. "&d1=".$d1 . "&y1=".$y1. "&m2=".$m2 . "&d2=".$d2 . "&y2=".$y2 . "&incount=".$inboxcounter . "&sentcount=".$sentcounter  ); ?>"><?PHP print($rowz["subject"]); ?>
</a>
</td>
</tr>

i will need to pass the m1,  d1, y1 and m2, d2, y2 variables to compose.php ahref link in the code above.

any help will be greatly appreciated. thanx
Link to comment
Share on other sites

well...that example you showed that you want it to be like, is pretty much what you need to do. Have you tried it? Getting some kind of error?  Or are you asking how you would retrieve the info, once the linkie is clicked? You can access them in the $_GET array

example:
[code]
echo $_GET['mess_id'];
echo $_GET['m1'];
.
.
[/code]

p.s. - please use code tags!
Link to comment
Share on other sites

i don't get it...perhaps you should re-explain your whole situation here, because what I'm hearing is that you have like 5 variables that are being passed through the url, but you only want to pass 4 of them? So I'm wanting to tell you to uh, just remove one of them.  But I somehow doubt that's what you mean, so please re-explain what you're wanting to do.

[code]
<a href = 'somepage.php?var1=value1&var2=value2&var3=value3'>blah</a>
[/code]

this passes 3 variables in the link, when the user clicks it.  Then, to access those variables on somepage.php, you would use the $_GET array.  If you only want to pass the year, month and day, then only put the year, month and day in the url string. If you know how to do all of that, then I really don't see what your issue is here? Again, please explain in more detail.


Link to comment
Share on other sites

im trying the exact same syntax u gave me here...

do i need to include any quotes(" or ') before or after each & sign?

i tried passing variables exactly same way u showed my here...

<a href = 'somepage.php?var1=value1&var2=value2&var3=value3'>blah</a>

but, it shows up as ...

compose.php?m1=$m1&d1=$d1&y1=$y1&m2=$m2&d2=$d2&y2=$y2

when i point on the hyperlink!

am i wrong somewehre. i know i am,...but not sure where
Link to comment
Share on other sites

if it is inside php tags, it would look like this:

[code]
<?php
  echo "<a href = 'compose.php?m1=$m1&d1=$d1&y1=$y1&m2=$m2&d2=$d2&y2=$y2'>blah</a>";
?>
[/code]

if it is outside php tags, it should looks like this:

[code]

<a href = "compose.php?m1=<?php echo $m1; ?>&d1=<?php echo $d1; ?>&y1=<?php echo $y1; ?>&m2=<?php echo $m2; ?>&d2=<?php echo $d2; ?>&y2=<?php echo $y2; ?>">blah</a>

[/code]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.