Jump to content

PHP inside HTML issue


Recommended Posts

Hello!

I have a simple HTML form with some PHP inside it:

[code]
<p>Upload new image:
<input type="file" name="image_filename" id="image_filename"
                           value="<?php echo $row['ImagePath']; ?>" /></p>
[/code]

All I want to do is display the contents of the field called "ImagePath" which is the path to an image stored on the server.

The user can then click the browse button to change the path if they wish.

I have no errors returned, but the path to the image is not displayed in the input field in the browser.

I have done this for other input fields with a "type" of "text" and it works.

Can anyone tell me what I am doing wrong?


Cheers!
Link to comment
https://forums.phpfreaks.com/topic/7203-php-inside-html-issue/
Share on other sites

Hiya!
I have checked field names and everything is correct.

This is some more code here:

[code]
<?php

  If (isset ($_SESSION['AdminAccess']))

{

      $admin_username = $_SESSION['AdminUsername'];


          include ('common_db.php');


          $link_id = db_connect();

     //-----------------------PULL UP PAGE DETAILS-----------------------------------------


                  $selectquery = "SELECT * FROM table WHERE FieldIDNumber = '" . $_GET['id'] . "'";
                  $result = mysql_query($selectquery) or die("Invalid query: " . mysql_error());

                  $row = mysql_fetch_array($result)


  ?>

<p>Last updated:<em><?php echo $row['FieldLastUpdate']; ?></em></p>

<form action="edit.php" method ="post" enctype="multipart/form-data">

<p>Alter name: <input type="text" name="Name" size="25" value=" <?php echo $row['Name']; ?>" /></p>

<p>Alter heading: <input type="text" name="Heading" size="25" value=" <?php echo $row['Heading']; ?>" /></p>

<p>Alter Entry: <textarea name="Body" cols="50" rows="50"><?php echo $row['Body']; ?></textarea></p>

<p>Upload new image: <input type="file" name="image_filename" id="image_filename" value="<?php echo $row['PageImage']; ?>"/></p>

<p>Alter image title: <input type="text" name="ImageTitle" value="<?php echo $row['ImageTitle']; ?>" /></p>

<p>Alter image alt text: <input type="text" name="AltText" value="<?php echo $row['ImageAltText']; ?>" /></p>

<p><input type="submit" value="submit" />

</form>



<?php




}

else

                  {
                   echo "<p>**You are not authorised to access this page!**</p>";
                   echo "<p><a href=\"AdminLogin.html\">login</a></p>";
                   }




?>
[/code]

What is interesting is when I view the page source for the output I get this:

[code]
<h2>Edit details</h2>

<form action="edit.php" method ="post" enctype="multipart/form-data">

<p>Alter name: <input type="text" name="Name" size="25" value=" Sitemap" /></p>

<p>Alter heading: <input type="text" name="Heading" size="25" value=" this is the heading" /></p>

<p>Alter body: <textarea name="Body" cols="50" rows="50">jf fjhjhuy  uy u yu </textarea></p>

<p>Upload new image: <input type="file" name="image_filename" id="image_filename" value="/uploadimages/image.gif"/></p>

<p>Alter image title: <input type="text" name="ImageTitle" value="image is the title" /></p>

<p>Alter image alt text: <input type="text" name="AltText" value="image is the alt text" /></p>

<p><input type="submit" value="submit" />

</form>

[/code]

The value seems to be pulled out, but the path is not displayed in the browser.

Weird!
Link to comment
https://forums.phpfreaks.com/topic/7203-php-inside-html-issue/#findComment-26237
Share on other sites

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.