Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 619287
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T18:38:17+00:00 2026-05-13T18:38:17+00:00

Hey, can someone help me make this an object please. Obviously not all my

  • 0

Hey, can someone help me make this an object please.

Obviously not all my code is here, but i’m sure you’ll get the gist.

<?php
$product_name_1 = $_POST['product_name_1'];
$region_1 = $_POST['region_1'];
$start_date_1 = $_POST['start_date_1'];
$end_date_1 = $_POST['end_date_1'];
$sku_1 = $_POST['sku_1'];

$product_name_2 = $_POST['product_name_2'];
$region_2 = $_POST['region_2'];
$start_date_2 = $_POST['start_date_2'];
$end_date_2 = $_POST['end_date_2'];
$sku_2 = $_POST['sku_2'];

$product_name_3 = $_POST['product_name_3'];
$region_3 = $_POST['region_3'];
$start_date_3 = $_POST['start_date_3'];
$end_date_3 = $_POST['end_date_3'];
$sku_3 = $_POST['sku_3'];
?>



<form action="" method="post" accept-charset="utf-8">
<div id="product_information">
<table id="product_1">
    <tr>
        <th><label for="product_name">Product Name</label></th>
        <th><label for="region">Select A Region</label></th>
        <th class="date"><label for="start_date">Start Date</label></th>
        <th class="date"><label for="end_date">End Date</label></th>
        <th><label for="sku">SKU</label></th>
    </tr>
    <tr>
        <td><input type="text" name="product_name_1" value="" id="product_name_1"></td>
        <td><input type="radio" name="region_1" value="upper_north" id="upper_north_1"><label for="upper_north_">Upper North Island</label><br />
                <input type="radio" name="region_1" value="lower_north" id="lower_north_1"><label for="lower_north_">Lower North Island</label><br />
                <input type="radio" name="region_1" value="south_island" id="south_island_1"><label for="south_island">South Island</label>   </td>
        <td class="date"><input type="text" class="date" name="start_date_1" value="" id="start_date_1"></td>
        <td class="date"><input type="text" class="date" name="end_date_1" value="" id="end_date_1"></td>
        <td><input type="text" name="sku_1" value="" id="sku_1"></td>
    </tr>
</table>
<span class="product"></span>
<div class="add-product">&nbsp;</div>
</div>

<script type="text/javascript" charset="utf-8">

var i = 1;

$('.add-product').click(function(){
    i++;
    $('span.product').replaceWith('<table id="product_'+i+'">'
        +'<tr>'
            +'<th><label for="product_name">Product Name</label></th>'
            +'<th><label for="region">Select A Region</label></th>'
            +'<th class="date"><label for="start_date">Start Date</label></th>'
            +'<th class="date"><label for="end_date">End Date</label></th>'
            +'<th><label for="sku">SKU</label></th>'
        +'</tr>'
        +'<tr>'
            +'<td><input type="text" name="product_name'+i+'" value="" id="product_name'+i+'"></td>'
            +'<td><input type="radio" name="region'+i+'" value="upper_north" id="upper_north'+i+'"><label for="upper_north'+i+'">Upper North Island</label><br />'
                    +'<input type="radio" name="region'+i+'" value="lower_north" id="lower_north'+i+'"><label for="lower_north'+i+'">Lower North Island</label><br />'
                    +'<input type="radio" name="region'+i+'" value="south_island" id="south_island"><label for="south_island">South Island</label>   </td>'
            +'<td class="date"><input type="text" class="date" name="start_date'+i+'" value="" id="start_date'+i+'"></td>'
            +'<td class="date"><input type="text" class="date" name="end_date'+i+'" value="" id="end_date'+i+'"></td>'
            +'<td><input type="text" name="sku'+i+'" value="" id="sku'+i+'"></td>'
        +'</tr>'
    +'</table>'
    +''
    +'<span class="product"></span>');
});
</script>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T18:38:18+00:00Added an answer on May 13, 2026 at 6:38 pm

    So now onto instantiating and using the new object.

    Could i make a construct like this?

    <? 
    class Product {
    
      private $Name;
      private $Region;
      private $StartDate;
      private $EndDate;
      private $Sku;
      public $i;
    
        function __construct($Name="product_name_$i" $Region="region_$i" $StartDate="start_date_$i" $EndDate="end_date_$i" $Sku="sku_$i")
        {
            $i++
        }
    
    }
    ?>
    

    And then how would i actually instantiate the object and use it in my code?.. can i do this with my JavaScript?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

hey guys, this might be really stupid, but hopefully someone can help. I'm trying
Hey guys, this is simple but I can't make it workn... blah! I have
Hey hope someone can help as I am at my wits end with this!?
This manages to create a new property on the object. But, can someone explain,
Hey, hope someone can help with this.. How can I get the previous ID
Hey Guys! Me again! Can someone provide me with some example code of how
Hey all how can i set this up for a loop? data.row9_1 I cant
Hey this is probably a dumb question but i can't seem to find a
Hey can someone help with the following? I'm trying to scrape a site that
Hey guys, I'm wondering can someone help me out. I'm using javascript to serialize

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.