Jump to content

Parse error T-Variable in URL link


jbuck20

Recommended Posts

Hi - I'm a novice coder and having a problem with my url link in my page navigation.  I tried using QUERY_STRING in the url and tested it on my remote server.  It worked fine except with each subsequent page click, the url grows longer retaining the previous query string.  The parameter I want to retain in the url is $date, a value I set earlier in the code.  I would like to add $date to the url link as in line 174.  I've tried echo $date and '$GET_['date']'.  I've tried changing the syntax many times but I always receive a parse T_Variable error expected ',' or ';'.  Can anyone help with this?  Many thanks in advance.

 

 

139        <!-- Navigation link needs to go here -->

140        <table border="0" align="default">

141 <tr id="pageNav">

142          <td width="64"><?php

143     // create a forward link for first page of records

144     if ($curPage > 0) {

145   echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING'].'&curPage=0"><< First</a>';

146   }

147     // otherwise leave the cell empty

148     else {

149   echo ' ';

150   }

151     ?>          </td>

152  

153   <td width="140"><?php

154     // create a back link if current page greater than 0

155     if ($curPage > 0) {

156   echo '<a href="'.$_SERVER['PHP_SELF'].'?date=&curPage='.($curPage-1).'">< Prev</a>';

157   }

158     // otherwise leave the cell empty

159     else {

160   echo ' ';

161   }

162     ?>          </td>

163          <?php

164     // pad the final row with empty cells if more than 2 columns

165     if (COLS-2 > 0) {

166   for ($i = 0; $i < COLS-2; $i++) {

167     echo '<td> </td>';

168     }

169   }

170     ?>

171          <td width="50"><?php

172     // create a forwards link if more records exist

173     if ($startRow+SHOWMAX < $totalPix) {

174   echo '<a href="'.$_SERVER['PHP_SELF'].'?date='$_GET['date'];'&curPage='.($curPage+1).'">Next {$date} ></a>';

175   }

176     // otherwise leave the cell empty

177     else {

178   echo ' ';

179   }

180     ?>

181   <td width="50"><?php

182     // create a forwards link for last group of records

183     if ($startRow+SHOWMAX < $totalPix) {

184   echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING'].'&curPage='.($lastPage).'">Last >></a>';

185   }

186     // otherwise leave the cell empty

187     else {

188   echo ' ';

189   }

190     ?>

Link to comment
https://forums.phpfreaks.com/topic/184271-parse-error-t-variable-in-url-link/
Share on other sites

you're not concatenating the strings/values.  changes line 174 to this:

 

echo '<a href="'.$_SERVER['PHP_SELF'].'?date='.$_GET['date'].'&curPage='.($curPage+1).'">Next {$date} ></a>';

 

notice the .'s before and after $_GET['date'] now?

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.