Jump to content

[SOLVED] Passing variable via url


dodgei

Recommended Posts

I'm saving the variables that I retrieve from the database into a link so that it can be passed to the next page.

 

My problem is that the 'Merchant' field sometimes contains multiple words. When I try to set the contents of the

'Merchant' field into the url, it is only setting the first word.

 

while($r = @odbc_fetch_array($results)) 
{
     echo "<tr><td>".$r['EntryID']."</td>";
 $alldate=substr($r['DueDate'],0,2).'.'.substr($r['DueDate'],2,2).'.'.substr($r['DueDate'],4,4);
 echo "<td>".$alldate."</td>";
 echo "<td>".$r['Merchant']."</td>";
 echo "<td>".$r['Amount']."</td>";
 echo "<td>".$r['Status']."</td>";
 echo "<td><a href=http://www.merediencapital.com/ada/makepay.php?action=pay
&row_id=" . $r['EntryID']."&merchant=". $r['Merchant']."&duedate=".$r['DueDate']."
&amount=".$r['Amount'].">Payment</a></td>";
     echo "<td><a href=" . $_SERVER['PHP_SELF'] . "?action=delete&row_id=" . $r['EntryID'].">delete</a></td></tr>";	  
}

 

How can I fix this?

Link to comment
https://forums.phpfreaks.com/topic/37176-solved-passing-variable-via-url/
Share on other sites

This is the link that it creates when there are 2 words in the 'Merchant' field,

 

http://www.merediencapital.com/ada/makepay.php?action=pay&row_id=22&merchant=Western

 

The value of the field is 'Western Printing'. And this is displayed when I use odbc to just echo the

contents of that field.

 

Why does it stop when it hits the space?

as far as i tried, the word space doesnt matter, but if that is the case for you, you can try replacing the space with some special string like "EGIEG" using str_replace() and use the same fuction to replace the special string back with space after passing through the url, in that way, you wont have this problem then.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.