Jump to content

Archived

This topic is now archived and is closed to further replies.

lyndsey.pearce@ntlworld.com

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!

Share this post


Link to post
Share on other sites
Does "$row['ImagePath']" contain anything at the time the HTML is rendered?

Can you post more of your code that leads up to this statement?

Ken

Share this post


Link to post
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!

Share this post


Link to post
Share on other sites

×

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.