Pulling My Hair Out - PHP Forms [migrated]
- by Joe Turner
Hello and good morning to all. This is my second post on this subject because the first time, things still didn't work and I have now literally been trying to solve this for about 4/5 days straight...
I have a file, called 'edit.php', in this file is a form;
<?php
$company = $_POST["company"];
$phone = $_POST["phone"];
$colour = $_POST["colour"];
$email = $_POST["email"];
$website = $_POST["website"];
$video = $_POST["video"];
$image = $_POST["image"];
$extension = $_POST["extension"];
?>
<form method="post" action="generate.php"><br>
<input type="text" name="company" placeholder="Company Name" /><br>
<input type="text" name="slogan" placeholder="Slogan" /><br>
<input class="color {required:false}" name="colour" placeholder="Company Colour"><br>
<input type="text" name="phone" placeholder="Phone Number" /><br>
<input type="text" name="email" placeholder="Email Address" /><br>
<input type="text" name="website" placeholder="Full Website - Include http://" /><br>
<input type="text" name="video" placeholder="Video URL" /><br>
<input type="submit" value="Generate QuickLinks" style="background:url(images/submit.png) repeat-x; color:#FFF"/>
</form>
Then, when the form is submitted, it creates a file using the variables that have been input. The fields that have been filled in go on to become links, I need to be able to say 'if a field is left blank, then put 'XXX' in as a default value'. Does anyone have any ideas? I really think I have tried everything. I'll put below a snippet from the .php file that generates the links...
<?php
$File = "includes/details.php";
$Handle = fopen($File, 'w');
?>
<?php
$File = "includes/details.php";
$Handle = fopen($File, 'w');
$Data = "<div id='logo'>
<img width='270px' src='images/logo.png'/img>
<h1 style='color:#$_POST[colour]'>$_POST[company]</h1>
<h2>$_POST[slogan]</h2>
</div>
<ul>
<li><a class='full-width button' href='tel:$_POST[phone]'>Phone Us</a></li>
<li><a class='full-width button' href='mailto:$_POST[email]'>Email Us</a></li>
<li><a class='full-width button' href='$_POST[website]'>View Full Website</a></li>
<li><a class='full-width button' href='$_POST[video]'>Watch Us</a></li>
</ul>
\n";
I really do look forward to any response...