Jump to content

Setting Variables using forms.


richardstan

Recommended Posts

Hi i have the following script:

<html>
<body>
<?php 
$imageURL;
$imageHeight;
$imageWidth;

$URL = "http://localhost/thumbnails/thumbs.php?image=".$imageURL."&height=".$imageHeight."&width=".$imageWidth;

<form action="<?php print URL?>" method="GET">
<input type="text" name=

How can i set the form so that it sets the values of $imageURL, $imageHeight and $imageWidth using the text written in the form, then follows the action already defined at the top of the form to forward onto the $URL i have used?

 

Thanks

Richard.

Link to comment
https://forums.phpfreaks.com/topic/125528-setting-variables-using-forms/
Share on other sites

  Quote

How can i set the form so that it sets the values of $imageURL, $imageHeight and $imageWidth using the text written in the form

 

You want these variables set BEFORE the form is submitted? So in other words, you want them to automatically set as soon as they type text into the fields?

 

If that's what you want, I'm sure you can get it done using AJAX. You can't do that with just PHP.

 

If what your trying to say is that they have already submitted one form and you want to fill the second one with the values of the first, then you would do this:

 

<html>
<body>

<?php 

$imageURL = $_POST['imageURL'];
$imageHeight = $_POST['imageHeight'];
$imageWidth = $_POST['imageWidth'];

$URL = "http://localhost/thumbnails/thumbs.php?image=".$imageURL."&height=".$imageHeight."&width=".$imageWidth;

?>

<form action="<?php print $URL; ?>" method="GET">
<input type="text" name="imageURL" value="<?php echo $imageURL; ?>">

 

If I completely missed the question, please explain in more detail.

 

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.