...

View Full Version : php issue



alex57
11-16-2006, 05:33 PM
Hello,

bit of an odd question, as this may be more javascript im not sure. I have a simple drop down box containing several values. Ideally i would like to select a value without using a button (with an onchange event) and use that value in an sql query. I have had a go myself below. Any help would be appreciated as I end up having to convert a javascript variable to php which cannot be done easily. Is there anyway to do this not using javascript and purely php??

thanks


<html>
<head>
<script language=JavaScript>
var TestVar
function show(form)
{
TestVar = form.clubs.value;
alert(TestVar);

var fred="<?php=$fred?>";
}
</script>

</head>
<body>
<form name"myform">
<select name=clubs onChange="show(this.form)">
<option value=select selected="selected">- Select -</option>
<option value=break>---------------------</option>
<option value=<?php $variable = goalkeepers?> >Goal Keepers</option>
<option value=<?php $variable = defenders?> > Defenders</option>"
<option value=midfielders>Midfielders</option>
<option value=strikers>Strikers</option>
<option value=break2>---------------------</option>
</select>
</form>
</script>
<?php
echo $variable;
?>
</body>
</html>

mlseim
11-16-2006, 07:12 PM
I just had this type of issue with someone else.

See this example page:
http://www.catpin.com/grillz

Now, in that example, I'm using another PHP script to re-size the image
using GD image library. In your case, the PHP script that is called would
take care of any MySQL stuff you need to do.

For any others that are interested in the image resize portion,
here's that script:



<?php
// The file
$filename = $_REQUEST['photo'];
$wid=135;
$hei=135;

// Content type
header('Content-type: image/jpeg');
header('Content-length: '.filesize($filename));

// Get new dimensions
list($width, $height) = getimagesize($filename);
$new_width = $wid;
$new_height = $hei;

// Resample
$image_p = imagecreatetruecolor($new_width, $new_height);
$image = imagecreatefromjpeg($filename);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);

// Output
imagejpeg($image_p, null, 100);
?>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum