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

Please use our new MachForm Community Forum instead.

MachForm Community Forums » MachForm 3

Using form values/Input to fill other forms


  1. chinuba
    Member

    Hello.

    Please help..I am stuck here.

    I want to be able to take the inputs (say Name and address) from one form and use it to populate the next form.

    The essence is:
    The first form is the lead generation for our website. As soon as the user puts in their name and address and other information, they submit. The next form will be for other details such as employment etc. The two forms go to different departments but I do not want the users to fill in their names and address for the 2nd time. Is there a way for me to populate the subsequent forms with some fields from the previous form?

    I really appreciate your previous support.

    Posted 9 years ago #
  2. timcov
    Member

    I would like to do the same thing. Machform is now simple to populate using url parameters so it would be great to be able to move from one form to the next by including url parameters in the redirect url.

    I understand it is possible by creating session variables but forum postings explaining this seem to relate to earlier versions and the relevant coding to be edited in post-functions.php seems to have changed.

    I'm a bit ignorant on php so can anyone help advise on the code amendment needed in version 3.4 to allow for 2 or 3 items of data to be passed? I wouldn't be using the review feature.

    I guess this is a common requirement so any help posted here would be much appreciated.

    Posted 8 years ago #
  3. Maurice
    Member

    Yep want the same feature badly hahahaha would be great even by a cookie would help.

    Posted 8 years ago #
  4. jacktearle
    Member

    Here is what I do. The first attachment (payment.txt) is the output of 'view source' when displaying the generated form. The second attachment (rep-payment.php) is the same form after I have edited it. The third attachment is the contents of the include file in line 15 ($UNIQ.php).

    ************************PAYMENT.TXT************************************************
    DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html  xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Enter Payment</title>
    <link rel="stylesheet" type="text/css" href="./data/form_10487/css/view.css" media="all" />
    <link rel="stylesheet" type="text/css" href="css_theme.php?theme_id=2" media="all" />
    <link href='http://fonts.googleapis.com/css?family=Open+Sans:300,300italic,400,400italic,600,600italic,700,700italic,800,800italic|Ubuntu:300,300italic,regular,italic,500,500italic,bold,bolditalic' rel='stylesheet' type='text/css'>
    
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
    <script type="text/javascript" src="js/jquery-ui/ui/jquery.effects.core.js"></script>
    <script type="text/javascript" src="view.js"></script>
    
    </head>
    <body id="main_body" class="">
    
    	<div id="form_container" class="WarpShadow WLarge WNormal">
    
    		<h1><a>Enter Payment</a></h1>
    		<form id="form_10487" class="appnitro top_label"  method="post" data-highlightcolor="#ccdced" action="#main_body">
    					<div class="form_description">
    			<h2>Enter Payment</h2>
    			<p>Record rent payment.  This process does not update the accounts receivable ledger.</p>
    		</div>
    			<ul >
    
    					<li id="li_1" >
    		<label class="description" for="element_1">CORP|BLDG|SUITE|ID </label>
    		<div>
    			<input id="element_1" name="element_1"  class="element text medium" type="text" value=""   />
    
    		</div>
    		</li>
    		<li id="li_2" >
    		<label class="description" for="element_2">Cheque Date </label>
    		<div>
    			<input id="element_2" name="element_2"  class="element text small" type="text" value=""   />
    
    		</div><p class="guidelines" id="guide_2"><small>Date on the cheque, not the date received.</small></p>
    		</li>
    		<li id="li_3" >
    		<label class="description" for="element_3">Cheque Number </label>
    		<div>
    			<input id="element_3" name="element_3" maxlength="12" class="element text small" type="text" value=""  onkeyup="limit_input(3,'c',12);" onchange="limit_input(3,'c',12);" />
    			<label for="element_3">Maximum of <var id="range_max_3">12</var> characters allowed.&nbsp;&nbsp; <em class="currently_entered">Currently Entered: <var id="currently_entered_3">0</var> characters.</em></label>
    		</div>
    		</li>
    		<li id="li_4"  >
    		<label class="description">Amount </label>
    		<span class="symbol">$</span>
    		<span>
    			<input id="element_4_1" name="element_4_1" class="element text currency" size="10" value="" type="text" /> .
    			<label for="element_4_1">Dollars</label>
    		</span>
    		<span>
    			<input id="element_4_2" name="element_4_2" class="element text" size="2" maxlength="2" value="" type="text" />
    			<label for="element_4_2">Cents</label>
    		</span>
    
    </li>
    		<li id="li_5"  >
    		<label class="description" for="element_5">Payment Type </label>
    		<div>
    		<select class="element select small" id="element_5" name="element_5">
    			<option value="" selected="selected"></option>
    <option value="1"  >Cheque</option>
    <option value="2"  >Debit</option>
    <option value="3"  >Credit Card</option>
    <option value="4"  >Money Order</option>
    
    		</select>
    		</div>
    		</li>
    					<li id="li_buttons" class="buttons">
    			    <input type="hidden" name="form_id" value="10487" />
    
    			    <input type="hidden" name="submit_form" value="1" />
    			    <input type="hidden" name="page_number" value="1" />
    				<input id="submit_form" class="button_text" type="submit" name="submit_form" value="Submit" />
    		</li>
    </ul>
    		</form>
    		<div id="footer">
    			Powered by <a href="http://www.appnitro.com">MachForm</a>
    		</div>
    	</div>
    
    	</body>
    </html>
    
    ***************************************REP-PAYMENT.PHP**********************************************
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <?php
            session_start();
            $uniq = session_id();
            $UNIQ = <code>echo $uniq|cut -c3-10</code>;
            $UNIQ=  rtrim($UNIQ);
    	$REF =  $_SERVER['QUERY_STRING'];
    	$REF  =  rtrim($REF);
    	$RECNO  = <code>echo $REF |cut -d&quot;?&quot; -f1</code>;
    	$RECNO = rtrim($RECNO);
    	$RECNO  = <code>echo $RECNO |cut -d&quot;=&quot; -f2</code>;
    	$RECNO = rtrim($RECNO);
    	<code>/u/remote/ksh/paymnt.ksh $UNIQ $RECNO >/dev/null 2>&amp;#038;1</code>;
            include ("/u/remote/input/$UNIQ.php");
    	$TNNTID=$CORP.$BLDG.$SUITE.$ID;
    ?>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Payment Entry</title>
    
    <link rel="stylesheet" type="text/css" href="../scripts/view.css" media="all" />
    <script type="text/javascript">
    
    function stopRKey(evt) {
      var evt = (evt) ? evt : ((event) ? event : null);
      var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
      if ((evt.keyCode == 13) && (node.type=="text"))  {return false;}
    }
    
    document.onkeypress = stopRKey;
    
    <script type="text/javascript" src="view.js"></script>
    <script type="text/javascript" src="calendar.js"></script>
    </head>
    <body id="main_body" >
    
    	<img src="top.png" alt="">
    	<div id="form_container">
    
    		<h1><a>Payment Entry</a></h1>
    		<form id="form_303551" class="appnitro"  method="post" action="acceditcash.php">
    					<div class="form_description">
    			<h2>Payment Entry</h2>
    			<p>Record a payment. Note that this process does not update accounts receivable.</p>
    		</div>
    			<ul >
    
    					<li id="li_1" >
    		<label class="description" for="element_1">Tenant ID </label>
    		<div><h4><?php echo $TNNTID ?></h4>
    			<input id="element_1" name="TNNTID" class="element text small" type="hidden" maxlength="6" value="<?php echo $TNNTID ?>"/>
    		<h4>Tenant Name  - <?php echo $NAME ?></h4>
    		<h4>Balance owing is <?php echo $BALANCE ?></h4>
    		</div> 
    
    </li>
    		<li id="li_2" >
    		<label class="description" for="element_6">Cheque Date </label>
    		<span>
    			<input id="element_6_1" name="CHQMM" class="element text" size="2" maxlength="2" value="<?php echo $CHQMM ?>" type="text"> /
    			<label for="element_6_1">MM</label>
    		</span>
    		<span>
    			<input id="element_6_2" name="CHQDD" class="element text" size="2" maxlength="2" value="<?php echo $CHQDD ?>" type="text"> /
    			<label for="element_6_2">DD</label>
    		</span>
    		<span>
    	 		<input id="element_6_3" name="CHQYY" class="element text" size="4" maxlength="4" value="<?php echo $CHQYY ?>" type="text">
    			<label for="element_6_3">YYYY</label>
    		</span>
    
    		<span id="calendar_6">
    			<img class="datepicker" src="calendar.gif" alt="Pick a date.">
    		</span>
    		<script type="text/javascript">
    			Calendar.setup({
    			inputField	 : "element_6_3",
    			baseField    : "element_6",
    			displayArea  : "calendar_6",
    			button		 : "cal_img_6",
    			ifFormat	 : "%B %e, %Y",
    			onSelect	 : selectDate
    			});
    		</script>
                    <p class="guidelines" id="guide_14"><small>The date on the cheque/money order</small></p>                                                              
    
    </li>
    	<li id="li_3" >
    		<label class="description" for="element_3">Cheque Number </label>
    		<div>
    			<input id="element_3" name="CHQNUM" maxlength="12" class="element text small" type="text" value=""  onkeyup="limit_input(3,'c',12);" onchange="limit_input(3,'c',12);" />
    			<label for="element_3">Maximum of <var id="range_max_3">12</var> characters allowed.&nbsp;&nbsp; <em class="currently_entered">Currently Entered: <var id="currently_entered_3">0</var> characters.</em></label>
    		</div>
    		</li>
    		<li id="li_4"  >
    		<label class="description">Amount</label>
    		<span class="symbol">$</span>
    		<span>
    			<input id="element_4_1" name="CHQAMT" class="element text currency" size="10" value="" type="text" /> .
    			<label for="element_4_1">Dollars</label>
    		</span>
    		<span>
    			<input id="element_4_2" name="CHQAMT2" class="element text" size="2" maxlength="2" value="" type="text" />
    			<label for="element_4_2">Cents</label>
    		</span>
    
    </li>
    		<li id="li_5"  >
    		<label class="description" for="element_5">Payment Type </label>
    		<div>
    		<select class="element select medium" id="element_5" name="element_5">
    			<option value="CQ" selected="selected">Cheque</option>
    <option value="DB"  >Debit</option>
    <option value="CC"  >Credit Card</option>
    <option value="MO"  >Money Order</option>
    
    		</select>
                    <p class="guidelines" id="guide_14"><small>Default is cheque. Do not accept cash.</small></p>
    		</div>
    		</li>
    	<li id="li_buttons" class="buttons">
    	    <input type="hidden" name="form_id" value="10487" />
    
    	    <input type="hidden" name="submit_form" value="1" />
    	    <input type="hidden" name="page_number" value="1" />
    	<input id="submit_form" class="button_text" type="submit" name="submit_form" value="Submit" />
    	</li>
    </ul>
    	</form>
    	<div id="footer">
    	Powered by <a href="http://www.appnitro.com">MachForm</a>
    	</div>
    </div>
    
    </body>
    </html>
    
    ************************************UNIQ.php***********************************************************
    <?php
    $CORP='2250    ';
    $BLDG='2250    ';
    $SUITE='0208';
    $ID='0001';
    $NAME='JOSE SANTOS';
    $RENT=' 975.00';
    $BALANCE='  00.00';
    ?>

    Some notes.
    The stopRKey function prevents the form from being submitted if the user presses <enter> to move from one field to another.
    I have replaced the date function with one from mattkruse.com

    Posted 8 years ago #

RSS feed for this topic

Reply