The following code worked on 7.0.0 and now SAME one (copy->paste) not working on 7.0.2. I've added a new PHP block to the pedit page and not working!
Does someone know what can be the problem? I tried also to put it on HTML block (removing the php (<?) sign and still after changing the dropdown list...nothing working..
?>
<div id="KidsWrapperForm" class="form_advanced_wrapper edit_form_wrapper" <form class="form_input_submit" id="KidsForm" action="<?= $_SERVER['PHP_SELF'] ?>" method="post"> Select how many kids you would like to register:
<select id='Numofkids' onChange="javascript: ShowMenu(document.getElementById('Numofkids').value,'divKid', 4);"> <option value='0'>Number of Kids <option value='1'>1 <option value='2'>2 <option value='3'>3 </select>
<div id='divKid1' style="display: none;"> <table> <tr> Details of the first kid:<br><br> <td>First Name:</td> <td><input type="text" name="FirstName1" value=""><br></td> </tr> <tr> <td>Grade:</td> <td><select id='Grade1' <option value='0'>Kid Grade <option value='1'>4 <option value='2'>5 <option value='3'>6 <option value='4'>7 <option value='5'>8 <option value='5'>9 <option value='4'>10 <option value='5'>11 <option value='5'>12 </select></td> </tr> <tr> <td>allergy:</td><td><input type="text" name="Allergic1" value=""></td> </tr> <tr> <td>Date of Birth:</td><td><input type="date" name="DOB1" value=""></td> </tr> </table> </div>
<div id='divKid2' style="display: none;"> <table> <tr> Details of the second kid:<br><br> <td>First Name:</td> <td><input type="text" name="FirstName2" value=""><br></td> </tr> <tr> <td>Grade:</td> <td><select id='Grade2' <option value='0'>Kid Grade <option value='1'>4 <option value='2'>5 <option value='3'>6 <option value='4'>7 <option value='5'>8 <option value='5'>9 <option value='4'>10 <option value='5'>11 <option value='5'>12 </select></td> </tr> <tr> <td>allergy:</td><td><input type="text" name="Allergic2" value=""></td> </tr> <tr> <td>Date of Birth:</td><td><input type="date" name="DOB2" value=""></td> </tr> </table> </div>
<div id='divKid3' style="display: none;"> <table> <tr> Details of the third kid:<br><br> <td>First Name:</td> <td><input type="text" name="FirstName3" value=""><br></td> </tr> <tr> <td>Grade:</td> <td><select id='Grade3' <option value='0'>Kid Grade <option value='1'>4 <option value='2'>5 <option value='3'>6 <option value='4'>7 <option value='5'>8 <option value='5'>9 <option value='4'>10 <option value='5'>11 <option value='5'>12 </select></td> </tr> <tr> <td>allergy:</td><td><input type="text" name="Allergic3" value=""></td> </tr> <tr> <td>Date of Birth:</td><td><input type="date" name="DOB3" value=""></td> </tr> </table> </div>
<div id='divKid4' style="display: none;"> <table> <tr> Details of 4th kid:<br><br> <td>First Name:</td> <td><input type="text" name="FirstName4" value=""><br></td> </tr> <tr> <td>Grade:</td> <td><select id='Grade4' <option value='0'>Kid Grade <option value='1'>4 <option value='2'>5 <option value='3'>6 <option value='4'>7 <option value='5'>8 <option value='5'>9 <option value='4'>10 <option value='5'>11 <option value='5'>12 </select></td> </tr> <tr> <td>allergy:</td><td><input type="text" name="Allergic4" value=""></td> </tr> <tr> <td>Date of Birth:</td><td><input type="date" name="DOB4" value=""></td> </tr> </table> </div>
<br> <input type="submit" value="Next Step"> </form>
</div>
<?
|
?> is a closing php tag
<? is an opening php tag
My opinions expressed on this site, in no way represent those of Boonex or Boonex employees. |
I know. Even when I'm putting it in an HTML block without the php open and close, it still not working |
HL meant the tags as shown in your original post are backwards.
But this will not work in a HTML block because the form line contains some PHP code.
It also will not work in a php block as it is written.
The opening and closing PHP tags are not used in either case.
When in a php block, the code needs to be inserted into a variable then echoed out. Like so,
$sCode = ' <div id="KidsWrapperForm" class="form_advanced_wrapper edit_form_wrapper" <form class="form_input_submit" id="KidsForm" action="<?= $_SERVER['PHP_SELF'] ?>" method="post"> Select how many kids you would like to register:
<select id='Numofkids' onChange="javascript: ShowMenu(document.getElementById('Numofkids').value,'divKid', 4);"> <option value='0'>Number of Kids <option value='1'>1 <option value='2'>2 <option value='3'>3 </select>
<div id='divKid1' style="display: none;"> <table> <tr> Details of the first kid:<br><br> <td>First Name:</td> <td><input type="text" name="FirstName1" value=""><br></td> </tr> <tr> <td>Grade:</td> <td><select id='Grade1' <option value='0'>Kid Grade <option value='1'>4 <option value='2'>5 <option value='3'>6 <option value='4'>7 <option value='5'>8 <option value='5'>9 <option value='4'>10 <option value='5'>11 <option value='5'>12 </select></td> </tr> <tr> <td>allergy:</td><td><input type="text" name="Allergic1" value=""></td> </tr> <tr> <td>Date of Birth:</td><td><input type="date" name="DOB1" value=""></td> </tr> </table> </div>
<div id='divKid2' style="display: none;"> <table> <tr> Details of the second kid:<br><br> <td>First Name:</td> <td><input type="text" name="FirstName2" value=""><br></td> </tr> <tr> <td>Grade:</td> <td><select id='Grade2' <option value='0'>Kid Grade <option value='1'>4 <option value='2'>5 <option value='3'>6 <option value='4'>7 <option value='5'>8 <option value='5'>9 <option value='4'>10 <option value='5'>11 <option value='5'>12 </select></td> </tr> <tr> <td>allergy:</td><td><input type="text" name="Allergic2" value=""></td> </tr> <tr> <td>Date of Birth:</td><td><input type="date" name="DOB2" value=""></td> </tr> </table> </div>
<div id='divKid3' style="display: none;"> <table> <tr> Details of the third kid:<br><br> <td>First Name:</td> <td><input type="text" name="FirstName3" value=""><br></td> </tr> <tr> <td>Grade:</td> <td><select id='Grade3' <option value='0'>Kid Grade <option value='1'>4 <option value='2'>5 <option value='3'>6 <option value='4'>7 <option value='5'>8 <option value='5'>9 <option value='4'>10 <option value='5'>11 <option value='5'>12 </select></td> </tr> <tr> <td>allergy:</td><td><input type="text" name="Allergic3" value=""></td> </tr> <tr> <td>Date of Birth:</td><td><input type="date" name="DOB3" value=""></td> </tr> </table> </div>
<div id='divKid4' style="display: none;"> <table> <tr> Details of 4th kid:<br><br> <td>First Name:</td> <td><input type="text" name="FirstName4" value=""><br></td> </tr> <tr> <td>Grade:</td> <td><select id='Grade4' <option value='0'>Kid Grade <option value='1'>4 <option value='2'>5 <option value='3'>6 <option value='4'>7 <option value='5'>8 <option value='5'>9 <option value='4'>10 <option value='5'>11 <option value='5'>12 </select></td> </tr> <tr> <td>allergy:</td><td><input type="text" name="Allergic4" value=""></td> </tr> <tr> <td>Date of Birth:</td><td><input type="date" name="DOB4" value=""></td> </tr> </table> </div>
<br> <input type="submit" value="Next Step"> </form>
</div> '; echo $sCode;
https://www.deanbassett.com |
Now that i look at it again, that won't work either due to how the php code in the form line is constructed. It was constructed for use in a php page
I don't see how this was working in either type of block in 7.0.0.
Did you pull this block of code from a php page, or a block?
https://www.deanbassett.com |
Deano,
Actually I used your mod to insert it in PHP code in the pedit page and the following code is working in 7.0.0 HOEVER same in 7.0.2 is not working.
here is the actual code from the PHP block:
function VerifyForm(&$values, &$errors) { // Do all necessary form verification /* if (strlen($values['name']) < 3) $errors['name'] = 'Name too short'; elseif (strlen($values['name']) > 50) $errors['name'] = 'Name too long'; // Needs better checking ;) if (!ereg('.*@.*..{2,4}', $values['email'])) $errors['email'] = 'Email address invalid'; if (strlen($values['text']) == 0) $errors['text'] = 'Text required';*/ return (count($errors) == 0); } function DisplayForm($values, $errors) { ?>
<div id="KidsWrapperForm" class="form_advanced_wrapper edit_form_wrapper" <form id="KidsForm" action="<?= $_SERVER['PHP_SELF'] ?>" method="post"> Select how many kids you would like to register:
<select id='Numofkids' onChange="javascript: ShowMenu(document.getElementById('Numofkids').value,'divKid', 4);"> <option value='0'>Number of Kids <option value='1'>1 <option value='2'>2 <option value='3'>3 </select>
<div id='divKid1' style="display: none;"> <table> <tr> Details of the first kid:<br><br> <td>First Name:</td> <td><input type="text" name="FirstName1" value=""><br></td> </tr> <tr> <td>Grade:</td> <td><select id='Grade1' <option value='0'>Kid Grade <option value='1'>4 <option value='2'>5 <option value='3'>6 <option value='4'>7 <option value='5'>8 <option value='5'>9 <option value='4'>10 <option value='5'>11 <option value='5'>12 </select></td> </tr> <tr> <td>allergy:</td><td><input type="text" name="Allergic1" value=""></td> </tr> <tr> <td>Date of Birth:</td><td><input type="date" name="DOB1" value=""></td> </tr> </table> </div>
<div id='divKid2' style="display: none;"> <table> <tr> Details of the second kid:<br><br> <td>First Name:</td> <td><input type="text" name="FirstName2" value=""><br></td> </tr> <tr> <td>Grade:</td> <td><select id='Grade2' <option value='0'>Kid Grade <option value='1'>4 <option value='2'>5 <option value='3'>6 <option value='4'>7 <option value='5'>8 <option value='5'>9 <option value='4'>10 <option value='5'>11 <option value='5'>12 </select></td> </tr> <tr> <td>allergy:</td><td><input type="text" name="Allergic2" value=""></td> </tr> <tr> <td>Date of Birth:</td><td><input type="date" name="DOB2" value=""></td> </tr> </table> </div>
<div id='divKid3' style="display: none;"> <table> <tr> Details of the third kid:<br><br> <td>First Name:</td> <td><input type="text" name="FirstName3" value=""><br></td> </tr> <tr> <td>Grade:</td> <td><select id='Grade3' <option value='0'>Kid Grade <option value='1'>4 <option value='2'>5 <option value='3'>6 <option value='4'>7 <option value='5'>8 <option value='5'>9 <option value='4'>10 <option value='5'>11 <option value='5'>12 </select></td> </tr> <tr> <td>allergy:</td><td><input type="text" name="Allergic3" value=""></td> </tr> <tr> <td>Date of Birth:</td><td><input type="date" name="DOB3" value=""></td> </tr> </table> </div>
<div id='divKid4' style="display: none;"> <table> <tr> Details of 4th kid:<br><br> <td>First Name:</td> <td><input type="text" name="FirstName4" value=""><br></td> </tr> <tr> <td>Grade:</td> <td><select id='Grade4' <option value='0'>Kid Grade <option value='1'>4 <option value='2'>5 <option value='3'>6 <option value='4'>7 <option value='5'>8 <option value='5'>9 <option value='4'>10 <option value='5'>11 <option value='5'>12 </select></td> </tr> <tr> <td>allergy:</td><td><input type="text" name="Allergic4" value=""></td> </tr> <tr> <td>Date of Birth:</td><td><input type="date" name="DOB4" value=""></td> </tr> </table> </div>
<br> <input type="submit" value="Next Step"> </form>
</div>
<?php } function ProcessForm($values) { // mail('foo@bar.com', 'Form test', $values['text'], "From: "{$values['name']}" <{$values['email']}>"); // Replace with actual page or redirect :P // echo "<html><head><title>Thank you!</title></head><body>The value is ". $_POST['name']. "</body></html>";
$iMemberID = (int)$_COOKIE['memberID'];
$sql = "INSERT INTO `kids` (`ID`, `kid1name`, `kid1allergies`, `kid1dob`, `kid1sex`, `kid1grade`) VALUES ('3','". $_POST['FirstName1']. "','". $_POST['Allergic1']. "' ,'". $_POST['DOB1']. "', '". $_POST['sex1']. "' , '". $_POST['Grade1']. "')"; # $result = mysql_query($sql);
# if ($result){ # //echo "1 Record Data was inserted!<br/>"; echo "Information was updated!<br/>"; # } else { # echo "An error occured during insert!<br/>"; # }
DisplayForm($_POST, $formErrors);
} if ($_SERVER['REQUEST_METHOD'] == 'POST') { $formValues = $_POST; $formErrors = array(); if (!VerifyForm($formValues, $formErrors)) DisplayForm($formValues, $formErrors); else ProcessForm($formValues); } else DisplayForm(null, null);
|
i bet if you go in the db and find that page block and put that code in from the database then clear the site cache the code will work... just my two cents
sys_page_compose i think it is in.
https://dolphin-techs.com - Skype: Dolphin Techs |
I wish it could work from just copy the content from the table.
I'm using Deano's mod however there is something in 7.0.2. Picking from dropdown list should extand the form down but nothing.
|
Could you make a few predefined value lists in admin and have it pull the drop down info from the lists ? https://dolphin-techs.com - Skype: Dolphin Techs |
Ok, so thats why i was confused. You did not show all of the code.
There is a javascript call here that might not be working.
onChange="javascript: ShowMenu(document.getElementById('Numofkids').value,'divKid', 4);">
Is that a default javascript function in one of dolphins javascript files, or is it something you added?
See if your browser is throwing a javascript error like ShowMenu is not defined.
It's this that you said. Picking from dropdown list should extand the form down but nothing. That tells me it's a javascript issue.
https://www.deanbassett.com |
Deano, SAME CODE, SAME BROWSER AND SAME INSERT WITH YOUR mod work on 7.0.0 and not in 7.0.2
I'm using firefox with two tabs...so weird
This is a javescript I've added (found this example on the web)
|
Deano, any idea what can cause that behaviour?? I have the two versions on my laptop and running on the same code and browser with your insert PHP code |