#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    1
    Rep Power
    0

    5 categories on 5 pages dynamic tables


    Hi everyone, I am new at php and Dreamweaver and I need help I have a form that contains a category menu, there are 5 categories, I have created 5 pages for each category, when someone posts, I need that post to appear on the page according to the category selected, for example : if I choose Autos and make a advert , that advert should appear on the Autos page. Also, I have managed to create a multiple photo upload which works when I select the photos but I am stuck there, I need a table in my database and make that appear on each dynamic table next to the adverts as well. </form>
    <p>&nbsp;</p>
    <form method="post" name="form2" action="<?php echo $editFormAction; ?>">
    <table align="center">
    <tr valign="baseline">
    <td nowrap align="right">Email:</td>
    <td><span id="sprytextfield1">
    <input type="text" name="email" value="" size="32">
    <span class="textfieldRequiredMsg">Email necesario.</span></span></td>
    </tr>
    <tr valign="baseline">
    <td nowrap align="right">Categorias:</td>
    <td><span id="spryselect1">
    <select name="cat_name">
    <option value="">Elige categoría</option>
    <?php
    do {
    ?>
    <option value="<?php echo $row_rsCats['cats_name']?>"><?php echo $row_rsCats['cats_name']?></option>
    <?php
    } while ($row_rsCats = mysql_fetch_assoc($rsCats));
    $rows = mysql_num_rows($rsCats);
    if($rows > 0) {
    mysql_data_seek($rsCats, 0);
    $row_rsCats = mysql_fetch_assoc($rsCats);
    }
    ?>
    </select>
    <span class="selectRequiredMsg">Elige categoría.</span></span></td>
    <tr valign="baseline">
    <td nowrap align="right">Título:</td>
    <td><span id="sprytextfield2">
    <input type="text" name="product_name" value="" size="32">
    <span class="textfieldRequiredMsg">Título necesario.</span></span></td>
    </tr>
    <tr valign="baseline">
    <td align="right" valign="top" nowrap>Description:</td>
    <td><span id="sprytextarea1">
    <textarea name="description" cols="32" rows="10"></textarea>
    <span class="textareaRequiredMsg">Descripción necesaria.</span></span></td>
    </tr>
    <tr valign="baseline">
    <td nowrap align="right">&nbsp;</td>
    <td><p> <input type="file" name="multiUpload" id="multiUpload" multiple /> <?php if($_SERVER['REQUEST_METHOD'] == "POST")
    {
    if(move_uploaded_file($_FILES['file']['tmp_name'], "upload/".$_FILES['file']['name']))
    {
    echo($_POST['index']);
    }
    exit;
    }
    ?>

    </p></td>
    </tr>
    <tr valign="baseline">
    <td nowrap align="right">&nbsp;</td>
    <td><input type="submit" value="Publicar"></td>
    </tr>
    </table>
    <input type="hidden" name="MM_insert" value="form2">
    </form>
    <form method="post" name="form1" action="<?php echo $editFormAction; ?>">
    <input type="hidden" name="MM_insert" value="upload">
    </form>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <script type="text/javascript">
    var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1");
    var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2");
    var sprytextarea1 = new Spry.Widget.ValidationTextarea("sprytextarea1");
    var spryselect1 = new Spry.Widget.ValidationSelect("spryselect1");
    </script>
    <?php
    mysql_free_result($rsCats);

    mysql_free_result($rsProducts);

    mysql_free_result($rsImg);
    ?>
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 2003
    Posts
    3,351
    Rep Power
    594
    1) Please enclose your code in [ PHP ] tags. See the sticky at the top of this forum that says READ THIS BEFORE POSTING.
    2) Unfortunately if you are new to PHP you are starting off on the wrong foot. DO NOT use the deprecated MySQL extensions. Switch to PDO.
    3) It is hard to decipher what you are asking. You need to provide more information about you database schema (there are no queries in your code so obviously you are not posting everything). It sounds, at this point, more of a MySQL question than a PHP question.
    There are 10 kinds of people in the world. Those that understand binary and those that don't.

IMN logo majestic logo threadwatch logo seochat tools logo