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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.