----- Original Message ----- 
From: "whoisquilty"

I'm trying to create an input form. The user will input info into this form 
and it will then
insert into a database.

Here is my form code:

<form id="FormName" action="version_add2.php" method="get" name="FormName">
<p>VERSION TITLE*: <input type="text" name="versiontitle" size="59"
/></p>
<p>VERSION LENGTH: <input type="text" name="versionlength" size="8" />
minutes</p>
<p>RESOLUTION: <select name="resolution" size="1">
<option selected="selected" value="1080p">1080p</option>
<option value="480p">480p</option>
</select></p>
<p>ASPECT RATIO: <select name="aspectratio" size="1">
<option value="2.76:1">2.76:1 (MGM Camera 65)</option>
<option value="1.33:1/4:3">1.33:1/4:33 (Television)</option>
</select></p>
<p>COLOR: <select name="color" size="1">
<option selected="selected" value="C">Color</option>
<option value="B">Black &amp; White</option>
<option value="M">Color/Black &amp; White</option>
</select></p>
<p><input type="hidden" name="var" value="<?

$var = floor($_GET['var']);

print $var;

?>" /></p>
<p><input type="submit" name="Add" value="Add" /></p>

Here is the code from the beginning of the response page that receives the 
variables.
However, no matter what I do, nothing but the hidden value goes from one 
page to the
other.

<?
$var = floor($_GET['var']);
$versiontitle = floor($_GET['versiontitle']);
$versionlength = floor($_GET['versionlength']);
$resolution = floor($_GET['resolution']);
$aspectratio = floor($_GET['aspectratio']);
$color = floor($_GET['color']);
?>

Obviously there is more to this response page. But this is all the farther 
my browser gets.

What am I doing wrong here?

Jeremy

----------------------------------------
Hi Jeremy,
                 I didn't see a </form>

I had a bit of a chuckle at </p> - is that DTD 'Very Strict'? lol :)

The rest looks ok. Seems like a browser problem ie missing tag such as 
</form> as the only input string being returned is the string placed into 
the form by PHP.

Take out the floor() and echo the strings. Maybe you need stripslashes()

The HTML is a bit loose lol. some DTD strict and some DTD transitional. ie 
the difference between <br> and <br />

<input value="<?php echo($_GET['var']); ?>">
works better for me.

Also - an easier way to transfer GET/POST vars ...

$gets = 'var|versiontitle|versionlength|resolution|aspectratio|color';
$gets = explode('|', $gets);
foreach($gets as $get)
  {
  $$get = floor($_GET[$get]);
  }

also floor() has unexpected results. I use -
$x = 0 + $_GET['x'];
OR
$x = intval($x);

The only other possable problem I can see is method="get" - some browsers 
need method="GET" but I doubt that is the problem unless you are using a 
realy old browser.

OH - and this -

$color = floor($_GET['color']);
 is allways going to return null or zero as the string is non numeric

Thanks, Rob.


Reply via email to