PHP in HTML Field in Form

Home Forums Quform WordPress PHP in HTML Field in Form

This topic is: resolved
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #4700
    lawrencepepper
    Participant

    I am trying to use PHP in a form.

    I have an update form that populates with default values that are being generated from a query.

    One of the fields in my form is a File Upload field.

    Since there is not a way to show a dynamic default value for the file upload field I want to display the name of the current file that is in the database. I am using an HTML field and have placed the following code in it to display the name of the file that is stored in my database:

    <? echo "Current File: " . $row['file']; ?>

    But nothing shows. There is a query on the page that this form is on that gets the data from my database.

    This is the code form the page:

    <?php

    $rnumber = $_SESSION['iphorm_10']['iphorm_10_3'];

    echo "<h4>Part Number: " . $rnumber . "</h4>";

    $con = mysql_connect("localhost","xxx","xxx");
    if (!$con)
    {
    die('Could not connect: ' . mysql_error());
    }

    mysql_select_db("edata", $con);

    $result = mysql_query("SELECT * FROM part_record WHERE record_number = '$rnumber'");?>

    <?php

    if (mysql_num_rows($result)==0) {
    echo "[warning_box]The part number " . $rnumber . " does not exist. Please try again.[/warning_box]
    ";

    }
    else {
    while($row = mysql_fetch_assoc($result)) {?>

    [iphorm id=9 name="Update Part" values="current_description=<? echo $row['description']; ?>&amp;current_detailed=<? echo $row['detailed_description']; ?>&amp;current_notes=<? echo $row['notes']; ?>&amp;current_rnumber=<? echo $rnumber; ?>&amp;current_manufacturer=<? echo $row['manufacturer']; ?>&amp;current_mnumber=<? echo $row['manufacturer_number']; ?>&amp;current_altmanufacturer=<? echo $row['alt_manufacturer']; ?>&amp;current_altnumber=<? echo $row['alt_number']; ?>&amp;current_file=<? echo $row['file']; ?>&amp;current_file_description=<? echo $row['file_description']; ?>"]

    <?php
    }

    }?>

    #4705
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #4706
    lawrencepepper
    Participant

    I am not saving the filename here, I am looking it up from the database and trying to display it.

    L

    #4707
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #4709
    lawrencepepper
    Participant

    OK,

    Thanks.

    Can I suggest that in a future release the ability to place PHP in the HTML element be added.

    L

    #4743
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #4751
    lawrencepepper
    Participant

    Ally,

    Thanks! That worked.

    Great idea!

    L

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.
Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy