SOLVED | just one quick question...

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
gothica
Forum Newbie
Posts: 15
Joined: Thu Sep 08, 2005 5:24 am

SOLVED | just one quick question...

Post by gothica »

======================
the question:

in using the header form, let's say:

header("Location: Home.php?text=5");

then at Home.php i have a textbox with a blank value. how do i make it read the "...?textbox=5" so that it will show a value of 5 instead?
======================

things i've tried:


i've tried doing this on the textbox but it doesn't work

<input type="text" name="text" value="".$text>
or
<input type="text" name="text" value="".$_GET["text"]>
or
<input type="text" name="text" value="<?php echo $_GET["text"]; ?>">
Last edited by gothica on Fri Sep 16, 2005 12:44 am, edited 1 time in total.
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

Code: Select all

<input type="text" name="whatever" value="<? echo $_GET['text']; ?>">
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
gothica
Forum Newbie
Posts: 15
Joined: Thu Sep 08, 2005 5:24 am

Post by gothica »

i tried it but it only prints out the word "<? echo.." on the textbox.
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

are you sure the page is a PHP page? is the extention .html ?

The <? echo .. should be parsed before the HTML ever gets generated, so if you're running a PHP page on a PHP enabled webserver, then the echo should never be seen.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
gothica
Forum Newbie
Posts: 15
Joined: Thu Sep 08, 2005 5:24 am

Post by gothica »

yes its a php page. actually the whole program is in php.

here's part of the code (incase you wanna check it)

Code: Select all

<input type="text" name="meTOTAL" size="3" value = "<? echo $_GET["meTOTAL"]; ?>">' ;

 //ive also tried

  <input type="text" name="meTOTAL" size="3" value = "<? echo $_GET['meTOTAL']; ?>">' ;
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

short tags are likely off use <?php instead
ryanlwh
Forum Commoner
Posts: 84
Joined: Wed Sep 14, 2005 1:29 pm

Post by ryanlwh »

are you doing this:

Code: Select all

echo '<input type="text" name="meTOTAL" size="3" value = "<? echo $_GET["meTOTAL"]; ?>">' ;
This certainly would not work because the whole line is a string, and the <? echo .. ?> part is treated as a string. Unless you exited php mode before this line then the <? echo .. ?> would be parsed correctly.

If you're going for echoing the whole thing, it should be

Code: Select all

echo '<input type="text" name="meTOTAL" size="3" value = "'.$_GET["meTOTAL"].'">';

//or
echo "input type=\"text\" name=\"meTOTAL\" size=\"3\" value=\"$_GET[meTOTAL]\">";
gothica
Forum Newbie
Posts: 15
Joined: Thu Sep 08, 2005 5:24 am

Post by gothica »

ryanlwh wrote:are you doing this:

Code: Select all

echo '<input type="text" name="meTOTAL" size="3" value = "<? echo $_GET["meTOTAL"]; ?>">' ;
This certainly would not work because the whole line is a string, and the <? echo .. ?> part is treated as a string. Unless you exited php mode before this line then the <? echo .. ?> would be parsed correctly.

If you're going for echoing the whole thing, it should be

Code: Select all

echo '<input type="text" name="meTOTAL" size="3" value = "'.$_GET["meTOTAL"].'">';

//or
echo "input type="text" name="meTOTAL" size="3" value="$_GET[meTOTAL]">";
that definitely worked! thanks a lot man and thanks to all those who replied!
Post Reply