This forum is no longer open and is for reading/searching only.

Please use our new MachForm Community Forum instead.

MachForm Community Forums » MachForm 2

Default photo?


  1. isak
    Member

    I have a form that allows users to upload up to 8 photos. The info from my form is displayed on a webpage. Is there a way to link to a "blank" photo by default? Otherwise, if a photo is not uploaded, I am getting a broken link graphic.

    I already have several that have been uploaded via the form to my database.

    Thanks.

    Posted 14 years ago #
  2. redityo

    Hi,

    How you manage the code to display a photo from machform in your web page? I think you can use something like this :

    $query = "select element_1 from ap_form_15";
    
    $result = do_query($query);
    
    while($row = do_fetch_result($result)){
    	if (empty($row['element_1'])) {
    		//code to show broken image or default image
    	} else {
    		//code to show the file from machform
    	}
    }

    The flow is like this, first it will query a data from form 15 with element 1 as an upload field. Then if element_1 have empty value it will show broken image, otherwise it will show the photo from machform data.


    MachForm Support

    Posted 14 years ago #
  3. isak
    Member

    I am displaying my photos with this code:

    [code]<img src="http://sandragunn.com/listings/data/form_7/files/<?php echo $row_rsVarpass['element_158']; ?>" alt="Sandra Gunn Properties in Houston | Houston Real Estate" />
    <?php echo $row_rsVarpass['element_167']; ?>[/code]

    I have 8 photos on the page and want to extend it to possibly 20.

    If the value in a photo box is empty, I would like to default to an image called "transparent.gif" so I don't get the broken link image.

    Is this do-able?

    Posted 14 years ago #
  4. yuniar

    This is possible, however I'm afraid this one would be pretty much beyond MachForm.
    It's actually pretty simple task, but require lot of coding and adjustments.

    I suggest to get programmer to do this custom page for you. It should be a straight forward task for most PHP programmer.


    MachForm Founder

    Posted 14 years ago #

RSS feed for this topic

Reply