renaming form fields
Posted: Tue Jan 12, 2016 5:30 pm
hello all. i ran across a super simple shopping cart template that i really like. the html have no text fields only only drop downs and selections with 4 values to pass but i'm having a difficult time changing the code side of the template. as i mentioned there are only 4 values that need be passed on to the php script. my question is am i right in supposing that i can merely substitute the field names and id, in the html code, with the 4 names and id that i would like to use?
the database has been set up and a connection is established via php. this is actually the last piece of the puzzle. lol. until i get the html right i can't see what values are being passed to the db. i think that there are 5 form fields with the following names: " prod2_color1, prod2_qty1, prod2_color3, prod2_size1 and prod2_size3". as i asked previously is it possible to just substitute form field names with the ones i want (description, temple, quantity, price)?
the code looks like this:
thanks for all your support.
the database has been set up and a connection is established via php. this is actually the last piece of the puzzle. lol. until i get the html right i can't see what values are being passed to the db. i think that there are 5 form fields with the following names: " prod2_color1, prod2_qty1, prod2_color3, prod2_size1 and prod2_size3". as i asked previously is it possible to just substitute form field names with the ones i want (description, temple, quantity, price)?
the code looks like this:
Code: Select all
<form id="shoppingCart" method="POST" class="form-inline" name="basket_form" action="myconnection/prac0.php">
<div class="content">
<div class="navbar">
<div class="navbar-inner">
<ul class="nav custom_nav">
<li class="pull-left">
<div>
<a href="http://xxxx.co" class="btn btn-info">
<i class="icon-hand-left icon-white"></i>
Continue Shopping
</a>
</div>
</li>
<li class="pull-right">
<a href="http://xxxx.co/checkout.html">
<span class="btn btn-success continue_to_checkout" type="submit" value="Checkout" name="cont_to_checkout1">
Continue To Checkout
</span>
</a>
</li>
<li class="pull-right"> </li>
<li class="pull-right">
<div>
<button class="btn btn-danger remove_all" type="submit" name="remove_all1" value="remove_all" rel="tooltip" data-placement="bottom" data-original-title="Be careful! All products will be entirely removed from the basket!">
<i class="icon-remove icon-white"></i>
Remove All
</button>
</div>
</li>
</ul>
</div>
</div>
<div class="basket_list clearfix">
<div class="tables">
<table class="table table_header">
<thead>
<tr>
<th colspan="2" class="description">
Item Description
</th>
<th class="temple">
Temple
</th>
<th class="quantity">
Quantity
</th>
<th class="price">
Price
</th>
<th class="subtotal">
Subtotal
</th>
<th>
</th>
</tr>
</thead>
</table>
<table class="table">
<tbody>
<tr class="warning">
<td class="thumb" rowspan="2"><a href="javascript: void(0);" title="Link to product page"><img src="img/331.jpg" alt="" width="123" height="91" title="Product Image"></a></td>
<td class="description" rowspan="2">
<a class="item-name" href="javascript: void(0);" title="Link to product page">The Carat</a>
<div>
<div class="item-availability"><em>These Diamond Shape Spectacles Accentuate Anyone's Style and Grace</em>.</div>
<div class="item-sku">MDL331</div>
</div>
</td>
<td class="size">
<select class="span2" id="prod2_size1" name="prod2_size1">
<option value="Buffalo Horn" selected>Buffalo Horn</option>
<option value="Gold">Gold</option>
<option value="Rose Gold">Rose Gold</option>
<option value="White Gold">White Gold</option>
<option value="Titanium">Titanium</option>
<option value="Platinum">Platinum</option>
</select>
</td>
<td class="color">
<input type="hidden" id="prod2_color1" name="prod2_color1" value="no">
</td>
<td class="quantity">Qty: <input id="prod2_qty1" name="prod2_qty1" type="text" class="number" value="1" class="inline input-mini">
</td>
<td class="price">
<span class="currency">$</span><span class="amount">3000.00</span>
</td>
<td class="subtotal">
<span class="currency">$</span><span class="amount">3000.00</span>
</td>
<td class="remove">
<button class="btn btn-danger btn-mini" type="submit" name="prod2_remove1" value="remove_item" rel="tooltip" data-placement="left" data-original-title="Be careful! This item will be entirely removed from the basket!">
<i class="icon-remove icon-white"></i>
</button>
</td>
</tr>
<tr class="warning additional_empty">
<td class="empty_td" colspan="8">
</td>
</tr>
</tbody>
</table>
<table class="table">
<tbody>
<tr class="warning">
<td class="thumb" rowspan="2">
<a href="javascript: void(0);" title="Link to product page"><img src="img/332.JPG" width="123" height="91"></a></td>
<td rowspan="2" class="description">
<a class="item-name" href="javascript: void(0);" title="Link to product page">The Minimum</a>
<div>
<div class="item-availability">
<p><em>Timeless Design, </em><em>A true work of art</em>, <em>High Quality Lenses, </em><em>A Comfortable Fit</em></p>
</div>
<div class="item-sku">MDL332</div>
</div>
</td>
<td class="size">
<select class="span2" id="prod2_size1" name="prod2_size1">
<option value="Buffalo Horn" selected>Buffalo Horn</option>
<option value="Gold">Gold</option>
<option value="Rose Gold">Rose Gold</option>
<option value="White Gold">White Gold</option>
<option value="Titanium">Titanium</option>
<option value="Platinum">Platinum</option>
</select>
</td>
<td class="color"><input type="hidden" id="prod2_color1" name="prod2_color1" value="no">
</td>
<td class="quantity">Qty: <input id="prod2_qty1" name="prod2_qty1" type="text" class="number" value="1" class="inline input-mini">
</td>
<td class="price">
<span class="currency">$</span><span class="amount">4000.00</span>
</td>
<td class="subtotal">
<span class="currency">$</span><span class="amount">4000.00</span>
</td>
<td class="remove">
<button class="btn btn-danger btn-mini" type="submit" name="prod2_remove1" value="remove_item" rel="tooltip" data-placement="left" data-original-title="Be careful! This item will be entirely removed from the basket!">
<i class="icon-remove icon-white"></i>
</button>
</td>
</tr>
<tr class="warning additional_empty">
<td class="empty_td" colspan="8">
</td>
</tr>
</tbody>
</table>
<table class="table">
<tbody>
<tr class="warning">
<td class="thumb" rowspan="2">
<a href="javascript: void(0);" title="Link to product page">
<img src="img/333.jpg" width="123" height="91" title="Product Image">
</a>
</td>
<td class="description" rowspan="2">
<a class="item-name" href="javascript: void(0);" title="Link to product page">The Maximum</a>
<div>
<div class="item-availability"><em>Rimless frames</em>, <em> Sophistication & Elegance</em> by Design</div>
<div class="item-sku">MDL333</div>
</div>
</td>
<td class="size">
<select class="span2" id="prod2_size1" name="prod2_size1">
<option value="Buffalo Horn" selected>Buffalo Horn</option>
<option value="Gold">Gold</option>
<option value="Rose Gold">Rose Gold</option>
<option value="White Gold">White Gold</option>
<option value="Titanium">Titanium</option>
<option value="Platinum">Platinum</option>
</select>
</td>
<td class="color"><input type="hidden" id="prod2_color1" name="prod2_color1" value="no">
</td>
<td class="quantity"><label class="inline">Qty:</label><input id="prod2_qty1" name="prod2_qty1" type="text" class="number" value="1" class="inline input-mini">
</td>
<td class="price">
<span class="currency">$</span><span class="amount">5000.00</span>
</td>
<td class="subtotal">
<span class="currency">$</span><span class="amount">5000.00</span>
</td>
<td class="remove">
<button class="btn btn-danger btn-mini" type="submit" name="prod2_remove1" value="remove_item" rel="tooltip" data-placement="left" data-original-title="Be careful! This item will be entirely removed from the basket!">
<i class="icon-remove icon-white"></i>
</button>
</td>
</tr>
<tr class="warning additional_empty">
<td class="empty_td" colspan="8">
</td>
</tr>
</tbody>
</table>
<table class="table">
<tbody>
<tr class="warning">
<td class="thumb" rowspan="2"><a href="javascript: void(0);" title="Link to product page"></a><img src="img/POV_clip_image001.jpg" width="111" height="87"></td>
<td class="description" rowspan="2"><a class="item-name" href="javascript: void(0);" title="Link to product page">The Drop</a>
<div>
<div class="item-availability"><em>These Teardrop Cut Lenses with Lightweight Rimless frames are a work of art</em></div>
<div class="item-sku">MDL334</div>
</div></td>
<td class="size"><select class="span2" id="prod2_size3" name="prod2_size3">
<option value="Buffalo Horn" selected>Buffalo Horn</option>
<option value="Gold">Gold</option>
<option value="Rose Gold">Rose Gold</option>
<option value="White Gold">White Gold</option>
<option value="Titanium">Titanium</option>
<option value="Platinum">Platinum</option>
</select></td>
<td class="color"><input type="hidden" id="prod2_color3" name="prod2_color3" value="no"></td>
<td class="quantity"><label class="inline">Qty:</label>
<input id="prod2_qty1" name="prod2_qty1" type="text" class="number" value="1" class="inline input-mini"></td>
<td class="price"><span class="currency">$</span><span class="amount">6000.00</span></td>
<td class="subtotal"><span class="currency">$</span><span class="amount">6000.00</span></td>
<td class="remove"><button class="btn btn-danger btn-mini" type="submit" name="prod2_remove1" value="remove_item" rel="tooltip" data-placement="left" data-original-title="Be careful! This item will be entirely removed from the basket!"> <i class="icon-remove icon-white"></i> </button></td>