Announcement

Collapse
No announcement yet.

Switch issue

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Switch issue

    Hi
    I'm using a service called GravityPDF on my GravityForms plugin in Wordpress.
    The are many options to create nicely formatted PDF outputs from normal forms.
    I designed one that had the option to have a Digital Signature or a Real Signature (having a tablet plugged in to the computer).

    I am not a PHP programmer, so added the code:
    <p>Signed: {Signed:12} <img src="{Signature:16}" width="500" /></p>
    Inside the Form to make the Signature appear.
    The issue is that if the user does a digital signature, the PDF tries to place a real signature as an image as well, but as it doesn't exist a red cross appears in the PDF to represent a missing image.
    I was told I need a PHP switch. I was given one to try, from the plugin developer, but overtime it runs it causes a blank screen in the PDF. Not sure if the syntax is correct.
    PHP Code:
    <p>Signed: <p class="data_enter">
        <?php

    switch ( {Choose your method of signing:17} ) {
        case 
    “Digital Digital Signature”:
            echo 
    '<p>' . {Signed:12} . '</p>';
        break;
        
        case 
    “Real Signature”:
            echo 
    '<img src="' $form_data['field'][16][0] . '" width="500" />’;
        break;
    }

    ?></p></p>
    <p>Signature of the Claimant / Authorized representative</p>
    Can anyone tell me if this is right or wrong? It obviously uses merge tags and form_data. Any help would be great, as I don't write PHP at all.

    Thanks in advance

  • #2
    switch ( {Choose your method of signing:17} ) {
    case “Digital Digital Signature”:

    echo '<p>' . {Signed:12} . '</p>';
    break;
    case “Real Signature”:

    echo '<img src="' . $form_data['field'][16][0] . '" width="500" />’;
    break;
    }
    switch () should be a variable so switch($i). It should be in a if statement to check if it is set. Also the image needs to be uploaded to the server. For example


    if(isset($_REQUEST['signingmethod']){

    switch ( $_REQUEST['signingmethod']) {

    case “Digital Digital Signature”:

    echo "<p>{$_REQUEST['signature']}</p>";
    break;
    case “Real Signature”:

    if (file_exists($target_file)) {

    echo '<img src="' . $target_file. '" width="500" />’;
    $uploadOk = 0;
    }
    break;
    } }
    Last edited by fiveworlds; 04-30-2016, 04:30 PM.

    Comment

    Working...
    X