Hi there, I have a form which submits to the same page... it basically sends data to it regarding how many image uploads the user wishes to do and how many related links entries the user wishes to write.
Now the text boxes in the form submit the number so I need to figure out three things here.
Firstly, the page needs to check the form data the the entries are all numerical values, then it needs to show however many input boxes it needs... then finally when the form is submitted to another page, a mysql_query("INSERT INTO..") needs to be done, inserting the number of entries that were submitted.
So in the mysql code it should be checking that all boxes had urls in else don't perform the task on that particular box.. I don't need url validation, just a check that the input box does contain a value.
This is my page so far:
<?php
Include("includes/confstring.php");
Include("includes/variables.php");
$link = "update.php";
Include("includes/sessions.php");
If (!$_GET['id'])
{
header("location: $siteurl/admin/index.php");
}
else
{
$id = $_GET['id'];
Include("templates/header.php");
Include("templates/fateam.css");
?>
<table width="620" align="right">
<tr>
<td class="main">
<?
If ($_GET['type'] = 'option')
{
echo "Thank you, your section has been added. Would you like to add any related links or upload any images to the section?";
?>
<form name="option" action="options.php?id=<? echo $id ?>&type=add" method="post">
<br \n>Number of related links: <input type="text" name="rlinks" id="rlinks" value="0">
<br \n>Number of images: <input type="text" name="images" id="images" value="0">
<br \n>
<input type="submit" id="submit" value="Submit"><input type="reset" id="reset" value="Reset">
</form>
<?
}
else
{
</td>
</tr>
</table>
<?
Include("templates/footer.php");
}
}
?>
There is a reason for all the }}. 🙂
Now what I don't know how to to is draw in the if statement the correct number of boxes, then when the new form is submitted to sql page, how I can check all the boxes contain a value, and any that aren't are not submitted to the query, and then get the insert query done which I don't know how to do with multiple inserts... I know it sounds a lot but any help would be grately appreciated!
Thanks,
Chris 🙂