Cable Forum

Cable Forum (https://www.cableforum.uk/board/index.php)
-   Internet Discussion (https://www.cableforum.uk/board/forumdisplay.php?f=25)
-   -   This is going to be really easy (php) (https://www.cableforum.uk/board/showthread.php?t=12955)

Bifta 28-05-2004 15:57

This is going to be really easy (php)
 
Just not for me, I've done it before, but I can't remember how, basically I have a form, with say 1 text field, I want that field populated by whatever is suffixed on the URL, e.g.

http://www.blah.com/test.php?price=12345

Then, the form field should populate with 12345.

Simple eh? Just not for a plank like me, any help is as always appreciated.

Thanks.

Nemesis 28-05-2004 16:01

Re: This is going to be really easy (php)
 
Richard will be along any second :D

Bifta 28-05-2004 16:06

Re: This is going to be really easy (php)
 
Ah, I've fixed it

it was echo $whatever

Someone can close this now :D

Steve H 28-05-2004 16:18

Re: This is going to be really easy (php)
 
As you say ;)

Richard M 28-05-2004 20:10

Re: This is going to be really easy (php)
 
OK I'm bending the rules a little here but I'll just add that echo $something will work only if you have globals on.

The more usual (and secure) way is to use the following:
PHP Code:

<?php
/*
Let's say we have an URL like http://www.domain.com/index.php?something=value
To get this we need to use the HTTP GET array like so:
*/

$something = $_GET['something'];
echo 
$something;

// Or POST (if preceded by a method="post" in the HTML form tag)

$something = $_POST['something'];
echo 
$something;
?>

I'd do something like:
PHP Code:

<?php
$price 
= $_GET['price'];
echo 
"<input type=\"text\" name=\"price\" value=\"$price\" />";
?>



All times are GMT. The time now is 02:43.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
All Posts and Content are © Cable Forum