0

There are three pages page1, page2 and page3. When I press submit on my first form on page 1 my group name field can be catched with $_POST['groupname'] in the destination page but in the page 2 I have another form which when pressed should pass the value of $_POST['groupname'] to third page. On third page I receive the group name value but the characters after the white space are truncated. Like if I have captain india as group name so I can receive only "captain". Any idea how this can be resolved. Below is my code.

Form 1 (this is on page2 $_POST['groupname'])

add_shortcode('groupdetails','groupdetails');
    function groupdetails()
    {
        if(isset($_POST['Details']))
        {
            //max participants check start here
            global $form;   
            global $wpdb;

            //max participants check ends here


            echo '<form id="joinform" action="http://localhost:7777/wordpress/insert/" method="post">';
            echo "<input name='gid' type='hidden' value=".$_POST['gid'].">";
            echo "<input name='mygroup' type='hidden' value=".$_POST['groupname'].">";
            echo "Id : ".$_POST['gid']."<br>";
            echo "Group Name : ".$_POST['groupname']."<br>";
            echo "Group Type : ".$_POST['groupstype']."<br>";
            echo "Leader Name : ".$_POST['lfirstname']."<br>";
            echo "Address : ".$_POST['address']."<br>";
            echo "City : ".$_POST['city']."<br>";
            echo "State : ".$_POST['state']."<br>";
            echo "Zip : ".$_POST['zipicode']."<br>";
            echo "Meeting Days : ".$_POST['meetingdays']."<br>";
            echo "Meeting Time : ".$_POST['meetingtime']."<br>";
            echo "Max Participants : ".$_POST['maxparticipants']."<br>";
            echo "Children : ".$_POST['children']."<br>";
            echo "Description : ".$_POST['Description']."<br>";
            echo '<input name="Join" type="submit" value="Join" />';
            echo '</form>'; 
            }
    }

page3 (mygroup name variable is truncted after first blank white space on this page after submit is pressed on previous form)

add_shortcode('insertform','insertform');
    function insertform()
    {
    ob_start();
    global $wpdb;
    global $form;
    global $mygroup;
    $mygroup = $_POST['mygroup'];
    echo $mygroup;  //mygroup name value is truncated
}
3
  • Have you confirmed that echo "<input name='mygroup' type='hidden' value=".$_POST['groupname'].">"; contains the full groupname? Commented Jul 15, 2015 at 20:51
  • Thanks everybody the problem got solved ... infact I was missing quotes around my hidden attribute and the correct syntax which worked is echo '<input name="mygroups" type="hidden" value="'.$_POST['groupname'].'">';
    – Zeeshan
    Commented Jul 16, 2015 at 4:34
  • @GentlemanMax I am really grateful to you !!
    – Zeeshan
    Commented Jul 16, 2015 at 4:35

1 Answer 1

1

I was missing quotes around my hidden attribute in my html form. The correct syntax is

echo "<input name='mygroup' type='hidden' value=".$_POST['groupname'].">";

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.