View Full Version : php issue

11-16-2006, 06:33 PM

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??


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

var fred="<?php=$fred?>";

<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>
echo $variable;

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

See this example page:

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:

// The file
$filename = $_REQUEST['photo'];

// 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);