Skip to main content

Greg McVerry

Learning what you can't do with PHP

2 min read

Tried this as guestbookΒ  after I was able to save plain text to an html file, it's not the right thing to do...so close...Can display the data but need to display each entry and still can't get pesky var6 to display @InideWebCamp Online

<?php
Β 
$var1 = $_POST['user_name'];
$var2 = $_POST['user_text'];
$var3 = $_POST['user_instagram'];
$var4 = $_POST['user_twitter'];
$var5 = $_POST['user_email'];
$var6 = $_POST['user_msg'];
$fileHandle = fopen("guestbook.html", 'a');
fwrite(<div class="h-entry guestbook">);
fwrite(<p class="dt-published dates">);
fwrite(<time class="dt-published" datetime="<?php echo date("Y-m-d"); ?>"><?php echo date("Y-m-d"); ?></time>);
fwrite(</p>);
fwrite(<ul class="h-card deets">);
fwrite(<li class="p-author"><?php echo $var1; ?></li>);
fwrite(<li><a href="mailto:<?php echo $var5; ?>"></a><?php echo $var5; ?></li>);
fwrite(<li><a class="u-url" href="<?php echo $var2; ?>"><?php echo $var2; ?></a></li>);
fwrite(<li><a class="u-url" href="https://instagram.com/<?php echo $var3; ?>"><?php echo $var3; ?></a></li>);
fwrite(<li><a class="u-url" href="https://twitter.com/<?php echo $var4; ?>"><?php echo $var4; ?></a></li>0;
fwrite(</ul>);
fwrite(<p class="p-content notes">);
fwrite(<?php echo $var6; ?>);
fwrite(</p>);
fwrite(</div>);
fclose(guestbook.html);
?>
CLMOOC

Prev | Home | Join | ? | Next