Click to See Complete Forum and Search --> : Linking to other PHP page


Squid
December 8th, 2004, 01:37 AM
Hi there,

I have a page which displays all the stocks in the storage. My table looks like this:

// display.php
***************** StockID StockName
View Modify Delete 1 ABC
View Modify Delete 2 DEF
View Modify Delete 3 GHI

When user click on the View option, it will linked him to the view_stock.php. How can I link it to StockID so that he can view the details for StockID=1?

How to set the code?
<a href="view_stock.php.".StockID='.$row[0].'">View</a>

seems like I have some error here. how to solve?

visualAd
December 8th, 2004, 02:14 AM
This should work:

<a href="view_stock.php?StockID=<?php echo($row[0]); ?>">View</a>

Squid
December 8th, 2004, 03:13 AM
thanks a lot.

Squid
December 8th, 2004, 03:28 AM
<tr><td> Types: </td>
<td>
<select name="Types" >
<option value="1"'.$array[Types][1].'">Excellent</option>
<option value="2"'.$array[Types][2].'">Good</option>
<option value="3"'.$array[Types][3].'">Normal</option>
<option value="4"'.$array[Types][4].'">Bad</option>
</select>
</td>

Well, I retrieved the stock database by refering to the StockID. The value stored in the table for Types field is 3. How can I make my drop down menu to point to the 3rd option (which is Normal)? It is still showing the first value which is Excellent.

I want user to be able to view the stock details and then modify the details and submit it.

I am still new to PHP. Any help will be appreciated.

visualAd
December 9th, 2004, 01:37 AM
I'm not sure what your code is doing in that last example you posted, but it will produce invalid HTML. Something like this:

<option value="1"valueofarraytypes">Excellent</option>


If you want to have an option selected by default, use the selected attribute:

<option value="3" selected="selected">Normal</option>