View previous topic :: View next topic |
Author |
Message |
kuddel99 Smarty n00b
Joined: 07 May 2018 Posts: 4
|
Posted: Mon May 07, 2018 4:28 pm Post subject: syntax error: unbalanced parenthesis in if statement |
|
|
Hello
i have a question, maybe someone knows the solution. Sorry, because i am a beginner.
i wrote following code in my template: kartei.tpl.
this is only extract. since i add the following code, i get: fatal error.
Code: |
<tr>
{if (isset($_POST['muendl']))}
<td>Datum mündl. Prüfung</td>
<td>{if $klausurchanges == 0}<input type="text" size="20" name="pruefungsdatum_muendl" value="{$student.pruefungsdatum_muendl}" size="45" />{else}{$student.pruefungsdatum_muendl}{/if}</td>
{/if}
</tr>
|
it is so that i want to appear the input-field only if the button is clicked
Code: |
<input type="submit" name="muendl" value="mündl. Prüfung">
|
thanks for help, because i do not know what is wrong. i get the message: see topic |
|
Back to top |
|
bsmither Smarty Elite
Joined: 20 Dec 2011 Posts: 322 Location: West Coast
|
Posted: Mon May 07, 2018 5:46 pm Post subject: |
|
|
Try changing:
Code: | {if (isset($_POST['muendl']))} | to Code: | {if $smarty.post.muendl} |
|
|
Back to top |
|
kuddel99 Smarty n00b
Joined: 07 May 2018 Posts: 4
|
Posted: Mon May 07, 2018 5:54 pm Post subject: |
|
|
thanks , thats function ver well |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Tue May 08, 2018 8:57 am Post subject: |
|
|
bsmither wrote: | Try changing:
Code: | {if (isset($_POST['muendl']))} | to Code: | {if $smarty.post.muendl} |
|
More specifically,
Code: | {if isset($smarty.post.muendl)} |
And you should avoid using unnecessary parenthesises, '()' will evaluate the enclosed expression which may affect the results. |
|
Back to top |
|
kuddel99 Smarty n00b
Joined: 07 May 2018 Posts: 4
|
Posted: Tue May 08, 2018 9:22 am Post subject: |
|
|
hello bsmither and AnrDaemon
thanks for help, let me ask you something more, please.
i changed to your proposal and thanks for that.
but since i changed it , the input-fields disappears after clicking save. but although the dates/information are in the database. before it was not so.
after clicking the button 'muendl' the input fields should stay.
Do you know why the disappers?
thanks for help |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Tue May 08, 2018 10:30 am Post subject: |
|
|
Make it stay?
When you submit a form, the page is reloaded and will display whatever you've sent in response. |
|
Back to top |
|
bsmither Smarty Elite
Joined: 20 Dec 2011 Posts: 322 Location: West Coast
|
Posted: Tue May 08, 2018 4:10 pm Post subject: |
|
|
At the end of the template, add {debug}.
When the page is delivered to the browser, the browser will want to popup a window. Let it do so.
Scan the left pane of the window for the $klausurchanges variable. Check its value. |
|
Back to top |
|
kuddel99 Smarty n00b
Joined: 07 May 2018 Posts: 4
|
Posted: Wed May 09, 2018 12:21 pm Post subject: |
|
|
thanks |
|
Back to top |
|
|