We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 31223
    • 5 Posts
    Hi,
    I am making a enquiry form for my site and want to save data that comes in my URL as query parameter. The URL will be like this

    http://mysite/enquiry?name=vaibhav

    I need to save the data of enquiry form along with name coming in URL as parameter. In my snippet(enquiry_db) I added the code like this

    <?php
    function save( &$fields )
    	{
    		global $modx;
    		// Init our array
    		$dbTable = array();
    		$dbTable['name'] = $modx->db->escape($_GET['mailTo']);
    		$dbTable['email']      = $modx->db->escape($fields['email']);
    		$dbTable['message'] = $modx->db->escape($fields['message']);
    		
    		// Run the db insert query
    		$dbQuery = $modx->db->insert($dbTable, 'enquiry' );
    		return true;
    	}
    ?>
    


    I have the chunk(mycontactform) to get other info using form. The chink looks like this
    [+validationmessage+]
    <form method="post" action="[~[*id*]~]"><input type="hidden" name="formid" value="feedbackForm" />
    
    
    <label for="email">Your Email Address</label><br/>
    <input maxlength="40" name="email" size="40" type="text" />
    <br/>
    <label for="department">Enquiry Message</label><br/>
    <input maxlength="40" name="message" size="40" type="text" />
    <br/>
    Please enter the anti spam code below:
    <br/>
    <img src="[+verimageurl+]" border="1" alt="verification code" />
    
    <label for="vericode">code</label>
    <input name="vericode" size="20" type="text" />
    
    <input name="submit" type="submit" value="Send Feedback" />
    
    </form>
    


    and in my enquiry page, I am calling the adding the efomr as

    [!enquiry_db!]
    [!eForm? &formid=`feedbackForm` &tpl=`mycontactform` &eFormOnBeforeMailSent=`save` &report=`mailtemp`
     &to=[[test]] &subject=`Message from LearnMODx` &vericode=`1`!]
    



    Now every thing is working fine and data is also saving, but the query parameter is not saving (Snippet line : $dbTable[’name’] = $modx->db->escape($_GET[’mailTo’]))

    I am not getting what is the problem. If I try to display the get param, it is displaying but not saving in the DB. Please help

    Thanks