[SOLVED] GET help

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
C_Calav
Forum Contributor
Posts: 395
Joined: Wed Jun 02, 2004 10:55 pm
Location: New Zealand

[SOLVED] GET help

Post by C_Calav »

hi guys, i got this loop going listing all these planes and im using GET on the URL,

Code: Select all

<?php
    
echo "<tr>
         <td> 
 <a href='order1.php?P_Stock=<?php echo $P_Stock;>'> $P_Stock </a>  
        </td>
     	   <td>$P_Name</td>
     	   <td> $P_Cat </td>
     	   <td> $P_Scale </td>
     	   <td> $P_Length </td>
     	   <td> $P_Span </td>
     	   <td> $P_Price </td>
     	   <td> $P_Desc </td> </tr> ";
?>
on the next page i have to test if it works. and it doesnt, am i doing something wrong here?

thanx for your help it is much appriacted, first tiome round for this!

oh, and is there a better way of doing this?


Code: Select all

<?php

    $P_Stock = $_GET['P_Stock'];

    echo" stock is $P_Stock ";
 
?>
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

try:

Code: Select all

echo "<tr>
         <td>
<a href='order1.php?P_Stock=$P_Stock'> $P_Stock </a> 
        </td>
           <td>$P_Name</td>
           <td> $P_Cat </td>
           <td> $P_Scale </td>
           <td> $P_Length </td>
           <td> $P_Span </td>
           <td> $P_Price </td>
           <td> $P_Desc </td> </tr> ";

Make sure the url is correct, ie that it looks something like order1.php?P_Stock=5 or whatever, if it looks like order1.php?P_Stock= then $P_Stock isn't defined and your problem is before that echo.
User avatar
C_Calav
Forum Contributor
Posts: 395
Joined: Wed Jun 02, 2004 10:55 pm
Location: New Zealand

Post by C_Calav »

thanx very much you were right!
Post Reply