Jump to content

Form not displaying correctly


essjay_d12

Recommended Posts

THe following code does not seem to be displaying the submit button - so I can Send the hidden input value to the URL!?!

 

       
$directory = "user/";
$file = "index.html";   			
echo '<form action="webtest.php" method="get" name="url">';
echo "filename: $file " . "\n";
echo '<input type="hidden" name="url" value="';
echo $directory . "/" . $file;
echo '/><label><input type="submit" name="Submit" value="Submit" /></label></form>';
echo "<br/>";
echo "<br/>";

 

It prints the file name correctly so i know its running fine.

Link to comment
https://forums.phpfreaks.com/topic/51497-form-not-displaying-correctly/
Share on other sites

try

 

<?php
$directory = "user/";
$file = "index.html";

echo "<form action='webtest.php' method='get' name='url'>";
echo "filename: $file \n";
echo "<input type='hidden' name='url' value='$directory/$file' />";
echo "<label>";
echo "<input type='submit' name='Submit' value='Submit' />";
echo "</label>";
echo "</form>";
echo "<br/>";
echo "<br/>";

?>

 

pikemsu28 was correct

 

this code is cleaner

 

 

EDIT: option #2

 

<?php
$directory = "user/";
$file = "index.html";

?>
<form action='webtest.php' method='get' name='url'>";
filename: <?php echo $file ?>
<input type='hidden' name='url' value='<?php echo "$directory/$file" ?>' />
<label>
<input type='submit' name='Submit' value='Submit' />
</label>
</form>
<br/>
<br/>

 

 

PLEASE NOTE the  $directory has a / and so does the hidden field!!

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.