If else (Logical operators) *** OPGELOST ***
ik had even een vraagje, ik probeer ervoor te zorgen dat als je de textbox Facebooklink en txtTwitterlink en txtLinkedinlink niet hebt ingevuld dat je dan ook geen fieldset + table ziet.
Ik heb nu dit
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
if (!$_POST['txtFacebooklink'] == '' || !$_POST['txtTwitterlink'] == '' || !$_POST['txtLinkedinlink'] == ''){
$textdata.= "<div id=\"tab3Social\">
<fieldset style=\"width: 605px; height: 60px;\">
<legend>Social Media</legend>
<table border=\"0\" style=\"width: 605px; height: 60px;\" cellspacing=\"0\" cellpadding=\"3\">
<tr>";
// FACEBOOK
if ($_POST['chkFacebooklink'] == 'checked'){
$textdata.= "
<td style=\"height: 84px; padding-bottom: 30px;\" vertical-align=\"center\"><img src=\"image.php?id=1000004\" title=\"De facebook pagina van ". iv($_POST['txtFacebooklink']) ."\" onclick=\"window.open('http://www.facebook.com/". $_POST['txtFacebooklink'] ."','_blank','')\" style=\"cursor: pointer;\"</img> <span style=\"color: black; font-size: 10px;\">Facebook.com/<b>". iv($_POST['txtFacebooklink']) ."</b></span> </td>
";
}
// TWITTER
if ($_POST['chkTwitterlink'] == 'checked'){
$textdata.= "
<td style=\"height: 84px; padding-bottom: 30px;\" vertical-align=\"center\"><img src=\"image.php?id=1000005\" title=\"De twitter pagina van ". iv($_POST['txtTwitterlink']) ."\" onclick=\"window.open('http://www.twitter.com/". $_POST['txtTwitterlink'] ."','_blank','')\" style=\"cursor: pointer;\"></img> <span style=\"color: black; font-size: 10px;\">@<b>". iv($_POST['txtTwitterlink']) ."</b></span> </td>
";
}
// LINKEDIN
if ($_POST['chkLinkedinlink'] == 'checked'){
$textdata.= "
<td style=\"height: 84px; padding-bottom: 30px;\" vertical-align=\"center\"><img src=\"image.php?id=1000006\" title=\"De linkedin pagina van ". iv($_POST['txtLinkedinlink']) ."\" onclick=\"window.open('http://www.Linkedin.com/". $_POST['txtLinkedinlink'] ."','_blank','')\" style=\"cursor: pointer;\"></img> <span style=\"color: black; font-size: 10px;\">Linkedin.com/<b>". iv($_POST['txtLinkedinlink']) ."</b></span></td>
";
}
// END TABLE / FIELDSET
$textdata.= "</td></tr></table>
</fieldset>";
$textdata.= "</div>
";
}
$textdata.= "<div id=\"tab3Social\">
<fieldset style=\"width: 605px; height: 60px;\">
<legend>Social Media</legend>
<table border=\"0\" style=\"width: 605px; height: 60px;\" cellspacing=\"0\" cellpadding=\"3\">
<tr>";
if ($_POST['chkFacebooklink'] == 'checked'){
$textdata.= "
<td style=\"height: 84px; padding-bottom: 30px;\" vertical-align=\"center\"><img src=\"image.php?id=1000004\" title=\"De facebook pagina van ". iv($_POST['txtFacebooklink']) ."\" onclick=\"window.open('http://www.facebook.com/". $_POST['txtFacebooklink'] ."','_blank','')\" style=\"cursor: pointer;\"</img> <span style=\"color: black; font-size: 10px;\">Facebook.com/<b>". iv($_POST['txtFacebooklink']) ."</b></span> </td>
";
}
if ($_POST['chkTwitterlink'] == 'checked'){
$textdata.= "
<td style=\"height: 84px; padding-bottom: 30px;\" vertical-align=\"center\"><img src=\"image.php?id=1000005\" title=\"De twitter pagina van ". iv($_POST['txtTwitterlink']) ."\" onclick=\"window.open('http://www.twitter.com/". $_POST['txtTwitterlink'] ."','_blank','')\" style=\"cursor: pointer;\"></img> <span style=\"color: black; font-size: 10px;\">@<b>". iv($_POST['txtTwitterlink']) ."</b></span> </td>
";
}
if ($_POST['chkLinkedinlink'] == 'checked'){
$textdata.= "
<td style=\"height: 84px; padding-bottom: 30px;\" vertical-align=\"center\"><img src=\"image.php?id=1000006\" title=\"De linkedin pagina van ". iv($_POST['txtLinkedinlink']) ."\" onclick=\"window.open('http://www.Linkedin.com/". $_POST['txtLinkedinlink'] ."','_blank','')\" style=\"cursor: pointer;\"></img> <span style=\"color: black; font-size: 10px;\">Linkedin.com/<b>". iv($_POST['txtLinkedinlink']) ."</b></span></td>
";
}
// END TABLE / FIELDSET
$textdata.= "</td></tr></table>
</fieldset>";
$textdata.= "</div>
";
}
Iemand die een fout ziet? want hij laat hem nu sowieso niet zien.
Gewijzigd op 08/10/2012 12:20:22 door Sem E
Sem E op 08/10/2012 10:19:39:
Facebooklink en txtTwitterlink en txtLinkedinlink niet hebt ingevuld
Waarom zeg je en ( && ), maar zet je dan of ( || ) in de code?
Gewijzigd op 08/10/2012 10:30:42 door Kris Peeters
Ik zie dat jij hier geen $_POST gebruikt moet de code dan dit worden?
nee, doe maar met $_POST
Wat is een 'textbox'?
Thanks Kris
-- OPGELOST --
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
if (!($_POST['txtFacebooklink'] == '' && $_POST['txtTwitterlink'] == '' && $_POST['txtLinkedinlink'] == '')){
$textdata.= "<div id=\"tab3Social\">
<fieldset style=\"width: 605px; height: 60px;\">
<legend>Social Media</legend>
<table border=\"0\" style=\"width: 605px; height: 60px;\" cellspacing=\"0\" cellpadding=\"3\">
<tr>";
// FACEBOOK
if ($_POST['chkFacebooklink'] == 'checked'){
$textdata.= "
<td style=\"height: 84px; padding-bottom: 30px;\" vertical-align=\"center\"><img src=\"image.php?id=1000004\" title=\"De facebook pagina van ". iv($_POST['txtFacebooklink']) ."\" onclick=\"window.open('http://www.facebook.com/". $_POST['txtFacebooklink'] ."','_blank','')\" style=\"cursor: pointer;\"</img> <span style=\"color: black; font-size: 10px;\">Facebook.com/<b>". iv($_POST['txtFacebooklink']) ."</b></span> </td>
";
}
// TWITTER
if ($_POST['chkTwitterlink'] == 'checked'){
$textdata.= "
<td style=\"height: 84px; padding-bottom: 30px;\" vertical-align=\"center\"><img src=\"image.php?id=1000005\" title=\"De twitter pagina van ". iv($_POST['txtTwitterlink']) ."\" onclick=\"window.open('http://www.twitter.com/". $_POST['txtTwitterlink'] ."','_blank','')\" style=\"cursor: pointer;\"></img> <span style=\"color: black; font-size: 10px;\">@<b>". iv($_POST['txtTwitterlink']) ."</b></span> </td>
";
}
// LINKEDIN
if ($_POST['chkLinkedinlink'] == 'checked'){
$textdata.= "
<td style=\"height: 84px; padding-bottom: 30px;\" vertical-align=\"center\"><img src=\"image.php?id=1000006\" title=\"De linkedin pagina van ". iv($_POST['txtLinkedinlink']) ."\" onclick=\"window.open('http://www.Linkedin.com/". $_POST['txtLinkedinlink'] ."','_blank','')\" style=\"cursor: pointer;\"></img> <span style=\"color: black; font-size: 10px;\">Linkedin.com/<b>". iv($_POST['txtLinkedinlink']) ."</b></span></td>
";
}
// END TABLE / FIELDSET
$textdata.= "</td></tr></table>
</fieldset>";
$textdata.= "</div>";
}
$textdata.= ";";
?>
if (!($_POST['txtFacebooklink'] == '' && $_POST['txtTwitterlink'] == '' && $_POST['txtLinkedinlink'] == '')){
$textdata.= "<div id=\"tab3Social\">
<fieldset style=\"width: 605px; height: 60px;\">
<legend>Social Media</legend>
<table border=\"0\" style=\"width: 605px; height: 60px;\" cellspacing=\"0\" cellpadding=\"3\">
<tr>";
if ($_POST['chkFacebooklink'] == 'checked'){
$textdata.= "
<td style=\"height: 84px; padding-bottom: 30px;\" vertical-align=\"center\"><img src=\"image.php?id=1000004\" title=\"De facebook pagina van ". iv($_POST['txtFacebooklink']) ."\" onclick=\"window.open('http://www.facebook.com/". $_POST['txtFacebooklink'] ."','_blank','')\" style=\"cursor: pointer;\"</img> <span style=\"color: black; font-size: 10px;\">Facebook.com/<b>". iv($_POST['txtFacebooklink']) ."</b></span> </td>
";
}
if ($_POST['chkTwitterlink'] == 'checked'){
$textdata.= "
<td style=\"height: 84px; padding-bottom: 30px;\" vertical-align=\"center\"><img src=\"image.php?id=1000005\" title=\"De twitter pagina van ". iv($_POST['txtTwitterlink']) ."\" onclick=\"window.open('http://www.twitter.com/". $_POST['txtTwitterlink'] ."','_blank','')\" style=\"cursor: pointer;\"></img> <span style=\"color: black; font-size: 10px;\">@<b>". iv($_POST['txtTwitterlink']) ."</b></span> </td>
";
}
if ($_POST['chkLinkedinlink'] == 'checked'){
$textdata.= "
<td style=\"height: 84px; padding-bottom: 30px;\" vertical-align=\"center\"><img src=\"image.php?id=1000006\" title=\"De linkedin pagina van ". iv($_POST['txtLinkedinlink']) ."\" onclick=\"window.open('http://www.Linkedin.com/". $_POST['txtLinkedinlink'] ."','_blank','')\" style=\"cursor: pointer;\"></img> <span style=\"color: black; font-size: 10px;\">Linkedin.com/<b>". iv($_POST['txtLinkedinlink']) ."</b></span></td>
";
}
// END TABLE / FIELDSET
$textdata.= "</td></tr></table>
</fieldset>";
$textdata.= "</div>";
}
$textdata.= ";";
?>
------------------------
een textbox...
Gewijzigd op 08/10/2012 10:39:46 door Sem E