Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial

Justin Enayati
2,985 PointsIssue with my ITEMS LIST and ADD TO CART on SHIRT DETAILS PAGE>
So i seem to have an issue with my shirts page!
I seem to have everything correct, the form and table show up, along with image,price and paypal options.
my issue is as soon as i click on the size of the shirt to select and ad to cart, it automatically jumps me back to the shirts.php page.
i am very confused as to why this is happening, i have nothing linked directly to this page.
the form is correct and is pasted from paypal( the target and links are right)
any help would be great, i dont want to be stuck on this for days.
<?php include('include/products.php');
$product_id = $_GET["id"];
$product = $products[$product_id];
$section ="shirts";
$pageTitle = $product['nsme'];
include('include/header.php');
?>
<div class="section page">
<div class="wrapper">
<div class="breadcrumb"><a href="shirts.php"<a/> > <?php echo $product["name"]; ?></div>
<div class="shirt-picture">
<span>
<img src="<?php echo $product["img"]; ?>" alt="<?php echo $product["name"]; ?>">
</span>
</div>
<div class="shirt-details">
<h1><span class="price">$<?php echo $product["price"]; ?></span> <?php echo $product["name"]; ?>
<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="<?php echo $product["paypal"];?>">
<input type="hidden" name="item_name" value="<?php echo $product["name"]; ?>">
<table>
<tr>
<th>
<input type="hidden" name="on0" value="Size">
<label for="on0">Size</label>
</th>
<td>
<select name="os0" id="on0">
<option value="Small">Small </option>
<option value="Medium">Medium </option>
<option value="Large">Large </option>
<option value="X-Large">X-Large </option>
</select>
</td>
</tr>
</table>
<input type="submit" value="Add to Cart" name="submit">
</form>
<p class="note-designer">ipsum Aenean dignissim, enim quis varius tempor, magna mauris venenatis</p>
</div>
20 Answers

Randy Hoyt
Treehouse Guest TeacherIt all looks more or less correct. Could you view the source on one of the pages with the problem and share the generated HTML? (Either paste the code in here or upload it as an HTML file somewhere.) It's hard to troubleshoot this without seeing what the final generated HTML is.

Justin Enayati
2,985 PointsHey Randy,
Hope this helps, this is the inspect element of the shirt.php page.
thanks again i appreciate the help, if you need anything else, just let me know.
<html style="margin-top: 35px; position: relative !important;" conduit_compatibility_version="1"><head> <title></title> <link rel="stylesheet" href="css/style.css" type="text/css"> <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Oswald:400,700" type="text/css"> <link rel="shortcut icon" href="favicon.ico" type="image/x-icon"> <style>@media print { #main-iframe-wrapper .TOOLBAR_IFRAME { width: 0 !important; } html { margin-top: 0 !important; } }</style><style type="text/css">div#ad_seo_inner { color:#ffffff !important;} div#ad_seo_inner * { font-size:10px !important; line-height:10px !important; } div#ad_seo_inner span , div#ad_seo_inner .ad_seo_link {color:#2Dd4a4 !important;} div#ad_seo_inner span.ad_seo_details {color:#3Db4e4 !important;} div#ad_seo_box {background-color:rgba(0,0,0,0.9) !important; border:3px solid #0E694C !important;} div#ad_seo_inner .ad_seo_title , div#ad_seo_inner .ad_seo_item , div#ad_seo_inner .ad_seo_warning , div#ad_seo_inner a , #ad_seo_close {color:#ffffff !important;} div#ad_seo_inner .ad_seo_profileslist {display:none !important}</style><script>if (typeof(window.sendToApp) === 'undefined') {window.sendToApp = function(data, ctid) { var message = {type: 'InjectCommunicator', tabId: '20', data: data || null, toolbarCtid: ctid};var scr = document.createElement('script'); scr.id = 'InjectCommunicator'; scr.innerHTML = JSON.stringify(message); document.head.appendChild(scr);};}</script><script>if (typeof(window.sendToApp) === 'undefined') {window.sendToApp = function(data, ctid) { var message = {type: 'InjectCommunicator', tabId: '20', data: data || null, toolbarCtid: ctid};var scr = document.createElement('script'); scr.id = 'InjectCommunicator'; scr.innerHTML = JSON.stringify(message); document.head.appendChild(scr);};}</script><script>if (!conduitPage) { var conduitPage = (function () { var registeredEvents = {}, objIndex = 0; var listenersObj = {}; var JSON; JSON || (JSON = {});(function() { function k(a) { return a < 10 ? "0" + a : a } function o(a) { p.lastIndex = 0; return p.test(a) ? '"' + a.replace(p, function(a) { var c = r[a]; return typeof c === "string" ? c : "\u" + ("0000" + a.charCodeAt(0).toString(16)).slice(-4) }) + '"' : '"' + a + '"' } function l(a, j) { var c, d, h, m, g = e, f, b = j[a]; b && typeof b === "object" && typeof b.toJSON === "function" && (b = b.toJSON(a)); typeof i === "function" && (b = i.call(j, a, b)); switch (typeof b) { case "string": return o(b); case "number": return isFinite(b) ? String(b) : "null"; case "boolean": case "null": return String(b); case "object": if (!b) return "null"; e += n; f = []; if (Object.prototype.toString.apply(b) === "[object Array]") { m = b.length; for (c = 0; c < m; c += 1) f[c] = l(c, b) || "null"; h = f.length === 0 ? "[]" : e ? "[\n" + e + f.join(",\n" + e) + "\n" + g + "]" : "[" + f.join(",") + "]"; e = g; return h } if (i && typeof i === "object") { m = i.length; for (c = 0; c < m; c += 1) typeof i[c] === "string" && (d = i[c], (h = l(d, b)) && f.push(o(d) + (e ? ": " : ":") + h)) } else for (d in b) Object.prototype.hasOwnProperty.call(b, d) && (h = l(d, b)) && f.push(o(d) + (e ? ": " : ":") + h); h = f.length === 0 ? "{}" : e ? "{\n" + e + f.join(",\n" + e) + "\n" + g + "}" : "{" + f.join(",") +"}"; e = g; return h } } if (typeof Date.prototype.toJSON !== "function") Date.prototype.toJSON = function() { return isFinite(this.valueOf()) ? this.getUTCFullYear() + "-" + k(this.getUTCMonth() + 1) + "-" + k(this.getUTCDate()) + "T" + k(this.getUTCHours()) + ":" + k(this.getUTCMinutes()) + ":" + k(this.getUTCSeconds()) + "Z" : null }, String.prototype.toJSON = Number.prototype.toJSON = Boolean.prototype.toJSON = function() { return this.valueOf() }; var q = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,p = /[\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, e, n, r = { "\u0008": "\b", "\t": "\t", "\n": "\n", "\u000c": "\f", "\r": "\r", '"': '\"', "\": "\\" }, i; if (typeof JSON.stringify !== "function") JSON.stringify = function(a, j, c) { var d; n = e = ""; if (typeof c === "number") for (d = 0; d < c; d += 1) n += " "; else typeof c === "string" && (n = c); if ((i = j) && typeof j !== "function" && (typeof j !== "object" || typeof j.length !== "number")) throw Error("JSON.stringify"); return l("",{ "": a })}; if (typeof JSON.parse !== "function") JSON.parse = function(a, e) { function c(a, d) { var g, f, b = a[d]; if (b && typeof b === "object") for (g in b) Object.prototype.hasOwnProperty.call(b, g) && (f = c(b, g), f !== void 0 ? b[g] = f : delete b[g]); return e.call(a, d, b) } var d, a = String(a); q.lastIndex = 0; q.test(a) && (a = a.replace(q, function(a) { return "\u" + ("0000" + a.charCodeAt(0).toString(16)).slice(-4) })); if (/^[],:{}\s]$/.test(a.replace(/\(?:["\\/bfnrt]|u[0-9a-fA-F]{4})/g, "@").replace(/"[^"\\n\r]"|true|false|null|-?\d+(?:.\d*)?(?:[eE][+-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*[)+/g, ""))) return d = eval("(" + a + ")"), typeof e === "function" ? c({ "": d }, "") : d; throw new SyntaxError("JSON.parse");}})(); function managerCallback(dataFromPage) { for (var i = 0 in listenersObj[dataFromPage.topic]) { listenersObj[dataFromPage.topic][i](dataFromPage.data); delete listenersObj[dataFromPage.topic][i]; } } function addCallback(topic, callback) { if (!listenersObj[topic]) { listenersObj[topic] = []; } listenersObj[topic].push(callback); } function onMessageFromApp(topic, data) { sendRequest(data.ctid, null, topic, data.userData, function () { }, true, data.cbId); } this.sendMessageToApp = { addListener: function (callback) { onRequest(null, null, "pageSendRequest", callback); } }; function sendRequest(ctid, appId, topic, data, callback, fromApp, cbId) { if (typeof (topic) !== "string" ) { return { errorMessage: "Invalid topic, expected a string.", errorCode: 100 }; } if (typeof (data) !== "string") { return { errorMessage: "Invalid data, expected a string.", errorCode: 100 }; } if (appId) topic = ctid + "" + appId + "_tabs" + topic; if (!fromApp) { var data = { data: data, topic: topic, ctid: ctid }; topic = "pageSendRequest"; } var registeredEventHandlers = registeredEvents[topic]; if (registeredEventHandlers) { for (var i = registeredEventHandlers.length - 1; i >= 0; i--) { try { if (callback && !fromApp) { addCallback(data.topic, callback); } registeredEventHandlers[i].handler.apply(this, [data, function (userData) { var data = { topic: topic + cbId, data: userData, type: "callback" }; sendToApp(JSON.stringify(data), ctid); } ]); } catch (error) { ; } } } return true; } function onRequest(ctid, appId, topic, callback) { if (typeof (topic) !== "string") { return { errorMessage: "Invalid topic, expected a string.", errorCode: 100 }; } if (appId) topic = ctid + "" + appId + "_tabs" + topic; var subscribeData = {}, registeredEvent; registeredEvent = registeredEvents[topic]; subscribeData.handler = callback; if (!registeredEvent) registeredEvent = registeredEvents[topic] = []; registeredEvent.push(subscribeData); return true; } sendMessageToApp.addListener(function (data) { sendToApp(JSON.stringify(data), data.ctid); }); return { onMessageFromApp: onMessageFromApp, sendRequest: sendRequest, onRequest: { addListener: onRequest }, managerCallback: managerCallback, JSON: JSON }; })(); }</script><script>if (!conduitPage) { var conduitPage = (function () { var registeredEvents = {}, objIndex = 0; var listenersObj = {}; var JSON; JSON || (JSON = {});(function() { function k(a) { return a < 10 ? "0" + a : a } function o(a) { p.lastIndex = 0; return p.test(a) ? '"' + a.replace(p, function(a) { var c = r[a]; return typeof c === "string" ? c : "\u" + ("0000" + a.charCodeAt(0).toString(16)).slice(-4) }) + '"' : '"' + a + '"' } function l(a, j) { var c, d, h, m, g = e, f, b = j[a]; b && typeof b === "object" && typeof b.toJSON === "function" && (b = b.toJSON(a)); typeof i === "function" && (b = i.call(j, a, b)); switch (typeof b) { case "string": return o(b); case "number": return isFinite(b) ? String(b) : "null"; case "boolean": case "null": return String(b); case "object": if (!b) return "null"; e += n; f = []; if (Object.prototype.toString.apply(b) === "[object Array]") { m = b.length; for (c = 0; c < m; c += 1) f[c] = l(c, b) || "null"; h = f.length === 0 ? "[]" : e ? "[\n" + e + f.join(",\n" + e) + "\n" + g + "]" : "[" + f.join(",") + "]"; e = g; return h } if (i && typeof i === "object") { m = i.length; for (c = 0; c < m; c += 1) typeof i[c] === "string" && (d = i[c], (h = l(d, b)) && f.push(o(d) + (e ? ": " : ":") + h)) } else for (d in b) Object.prototype.hasOwnProperty.call(b, d) && (h = l(d, b)) && f.push(o(d) + (e ? ": " : ":") + h); h = f.length === 0 ? "{}" : e ? "{\n" + e + f.join(",\n" + e) + "\n" + g + "}" : "{" + f.join(",") +"}"; e = g; return h } } if (typeof Date.prototype.toJSON !== "function") Date.prototype.toJSON = function() { return isFinite(this.valueOf()) ? this.getUTCFullYear() + "-" + k(this.getUTCMonth() + 1) + "-" + k(this.getUTCDate()) + "T" + k(this.getUTCHours()) + ":" + k(this.getUTCMinutes()) + ":" + k(this.getUTCSeconds()) + "Z" : null }, String.prototype.toJSON = Number.prototype.toJSON = Boolean.prototype.toJSON = function() { return this.valueOf() }; var q = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,p = /[\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, e, n, r = { "\u0008": "\b", "\t": "\t", "\n": "\n", "\u000c": "\f", "\r": "\r", '"': '\"', "\": "\\" }, i; if (typeof JSON.stringify !== "function") JSON.stringify = function(a, j, c) { var d; n = e = ""; if (typeof c === "number") for (d = 0; d < c; d += 1) n += " "; else typeof c === "string" && (n = c); if ((i = j) && typeof j !== "function" && (typeof j !== "object" || typeof j.length !== "number")) throw Error("JSON.stringify"); return l("",{ "": a })}; if (typeof JSON.parse !== "function") JSON.parse = function(a, e) { function c(a, d) { var g, f, b = a[d]; if (b && typeof b === "object") for (g in b) Object.prototype.hasOwnProperty.call(b, g) && (f = c(b, g), f !== void 0 ? b[g] = f : delete b[g]); return e.call(a, d, b) } var d, a = String(a); q.lastIndex = 0; q.test(a) && (a = a.replace(q, function(a) { return "\u" + ("0000" + a.charCodeAt(0).toString(16)).slice(-4) })); if (/^[],:{}\s]$/.test(a.replace(/\(?:["\\/bfnrt]|u[0-9a-fA-F]{4})/g, "@").replace(/"[^"\\n\r]"|true|false|null|-?\d+(?:.\d*)?(?:[eE][+-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*[)+/g, ""))) return d = eval("(" + a + ")"), typeof e === "function" ? c({ "": d }, "") : d; throw new SyntaxError("JSON.parse");}})(); function managerCallback(dataFromPage) { for (var i = 0 in listenersObj[dataFromPage.topic]) { listenersObj[dataFromPage.topic][i](dataFromPage.data); delete listenersObj[dataFromPage.topic][i]; } } function addCallback(topic, callback) { if (!listenersObj[topic]) { listenersObj[topic] = []; } listenersObj[topic].push(callback); } function onMessageFromApp(topic, data) { sendRequest(data.ctid, null, topic, data.userData, function () { }, true, data.cbId); } this.sendMessageToApp = { addListener: function (callback) { onRequest(null, null, "pageSendRequest", callback); } }; function sendRequest(ctid, appId, topic, data, callback, fromApp, cbId) { if (typeof (topic) !== "string" ) { return { errorMessage: "Invalid topic, expected a string.", errorCode: 100 }; } if (typeof (data) !== "string") { return { errorMessage: "Invalid data, expected a string.", errorCode: 100 }; } if (appId) topic = ctid + "" + appId + "_tabs" + topic; if (!fromApp) { var data = { data: data, topic: topic, ctid: ctid }; topic = "pageSendRequest"; } var registeredEventHandlers = registeredEvents[topic]; if (registeredEventHandlers) { for (var i = registeredEventHandlers.length - 1; i >= 0; i--) { try { if (callback && !fromApp) { addCallback(data.topic, callback); } registeredEventHandlers[i].handler.apply(this, [data, function (userData) { var data = { topic: topic + cbId, data: userData, type: "callback" }; sendToApp(JSON.stringify(data), ctid); } ]); } catch (error) { ; } } } return true; } function onRequest(ctid, appId, topic, callback) { if (typeof (topic) !== "string") { return { errorMessage: "Invalid topic, expected a string.", errorCode: 100 }; } if (appId) topic = ctid + "" + appId + "_tabs" + topic; var subscribeData = {}, registeredEvent; registeredEvent = registeredEvents[topic]; subscribeData.handler = callback; if (!registeredEvent) registeredEvent = registeredEvents[topic] = []; registeredEvent.push(subscribeData); return true; } sendMessageToApp.addListener(function (data) { sendToApp(JSON.stringify(data), data.ctid); }); return { onMessageFromApp: onMessageFromApp, sendRequest: sendRequest, onRequest: { addListener: onRequest }, managerCallback: managerCallback, JSON: JSON }; })(); }</script><script>(function(){function selectionProcessor() {
function trimString(str) {
if (typeof (str) != "string")
return "";
return str.replace(/^\s+|\s+$/g, "");
}
function cutToMaxLatter(data) {
if (typeof (data) != "string")
return "";
if (data.length > 200) { //same behavior as old toolbar
data = data.substr(0, 200);
var index = data.lastIndexOf(" ");
if (index > 1)
data = data.substr(0, index);
}
return data;
}
function bindSelection() {
if (document.body && document.body.addEventListener) {
document.body.addEventListener("mouseup", handletext, false);
}
else if (document.body && document.body.attachEvent) {
document.body.attachEvent("onmouseup", handletext);
}
}
function handletext() {
var dataObj = {}; //can represent TextRange or SelectionObject objects depending browser
if (window.getSelection && document.activeElement) {
if (document.activeElement.nodeName == "INPUT" && document.activeElement.getAttribute("type").toLowerCase() == "text") {
var ta = document.activeElement;
dataObj = ta.value.substring(ta.selectionStart, ta.selectionEnd);
} else {
dataObj = window.getSelection();
}
} else if (document.getSelection) {
dataObj = document.getSelection();
} else if (document.selection) {
dataObj = document.selection.createRange().text;
} else
return;
if (!dataObj) //is dataObj is null or undefined or string empty etc.
return;
var txt = dataObj.toString();
txt = trimString(txt) || '';
txt = cutToMaxLatter(txt) || '';
if (txt) { //if not an empty string
conduitPage.sendRequest('CT3220468', '129813684258939747','search/plugin[onpage_selection]:onPageMessage', JSON.stringify({ 'name': "selection", 'text': txt }), function () { });
}
}
conduitPage.sendRequest('CT3220468', '129813684258939747','search/plugin[onpage_selection]:onPageMessage', JSON.stringify({ 'name': 'handshake' }), function () { });
return {
"bindSelection": bindSelection
}
} selectionProcessor().bindSelection(); })();</script><script id="InjectCommunicator">{"__type":"InjectCommunicator","tabId":"20","data":"{\"data\":\"{\\\"name\\\":\\\"handshake\\\"}\",\"topic\":\"CT3220468_129813684258939747_tabs_search/plugin[onpage_selection]:onPageMessage\",\"ctid\":\"CT3220468\"}","toolbarCtid":"CT3220468"}</script><script>try{if(_TPIHelper){var data = {type: "toolbarAPIUsed" }; window.top.postMessage(JSON.stringify(data), "*");}}catch(e){}</script><script>function EBCallBackMessageReceived_CT3220468_3340973282538731408_3340973282538731408___ejpbbhjlbipncjklfjjaedaieimbmdda(data) { conduitPage.sendRequest('CT3220468', '3340973282538731408','callBackToAppThroughAppToTabCommunication_0.9277440786827356', data); }</script><script>if (window.addEventListener) {
var callback_func = function(evt) { if ('undefined' != typeof evt.target && "A" == evt.target.nodeName) { var url = evt.target.href; EBCallBackMessageReceived_CT3220468_3340973282538731408_3340973282538731408_ejpbbhjlbipncjklfjjaedaieimbmdda(url); } return true; }; var cb_add_listener_result_click = window.addEventListener('click', callback_func, true); var cb_add_listener_result_contextmenu = window.addEventListener('contextmenu', callback_func, true); } else if (document.attachEvent) { var callback_func = function () { if ('undefined' != typeof event.srcElement &&'A' == event.srcElement.tagName) { var url = event.srcElement.href; EBCallBackMessageReceived_CT3220468_3340973282538731408_3340973282538731408_ejpbbhjlbipncjklfjjaedaieimbmdda(url); } return true; }; var cb_add_listener_result_click = document.attachEvent('onclick', callback_func); var cb_add_listener_result_contextmenu = document.attachEvent('oncontextmenu', callback_func); }
</script><script>function EBCallBackMessageReceived_CT3220468_3340973282538731408_3340973282538731408_ejpbbhjlbipncjklfjjaedaieimbmdda(data) { conduitPage.sendRequest('CT3220468', '3340973282538731408','callBackToAppThroughAppToTabCommunication_0.9277440786827356', data); }</script><script>if (window.addEventListener) { var callback_func = function(evt) { if ('undefined' != typeof evt.target && "A" == evt.target.nodeName) { var url = evt.target.href; EBCallBackMessageReceived_CT3220468_3340973282538731408_3340973282538731408ejpbbhjlbipncjklfjjaedaieimbmdda(url); } return true; }; var cb_add_listener_result_click = window.addEventListener('click', callback_func, true); var cb_add_listener_result_contextmenu = window.addEventListener('contextmenu', callback_func, true); } else if (document.attachEvent) { var callback_func = function () { if ('undefined' != typeof event.srcElement &&'A' == event.srcElement.tagName) { var url = event.srcElement.href; EBCallBackMessageReceived_CT3220468_3340973282538731408_3340973282538731408__ejpbbhjlbipncjklfjjaedaieimbmdda(url); } return true; }; var cb_add_listener_result_click = document.attachEvent('onclick', callback_func); var cb_add_listener_result_contextmenu = document.attachEvent('oncontextmenu', callback_func); }
</script><script>function EBCallBackMessageReceived_CT3220468_3340973282538731408_3340973282538731408_ejpbbhjlbipncjklfjjaedaieimbmdda(data) { conduitPage.sendRequest('CT3220468', '3340973282538731408','callBackToAppThroughAppToTabCommunication_0.9277440786827356', data); }</script><script>if (window.addEventListener) { var callback_func = function(evt) { if ('undefined' != typeof evt.target && "A" == evt.target.nodeName) { var url = evt.target.href; EBCallBackMessageReceived_CT3220468_3340973282538731408_3340973282538731408ejpbbhjlbipncjklfjjaedaieimbmdda(url); } return true; }; var cb_add_listener_result_click = window.addEventListener('click', callback_func, true); var cb_add_listener_result_contextmenu = window.addEventListener('contextmenu', callback_func, true); } else if (document.attachEvent) { var callback_func = function () { if ('undefined' != typeof event.srcElement &&'A' == event.srcElement.tagName) { var url = event.srcElement.href; EBCallBackMessageReceived_CT3220468_3340973282538731408_3340973282538731408__ejpbbhjlbipncjklfjjaedaieimbmdda(url); } return true; }; var cb_add_listener_result_click = document.attachEvent('onclick', callback_func); var cb_add_listener_result_contextmenu = document.attachEvent('oncontextmenu', callback_func); }
</script><script>function EBCallBackMessageReceived_CT3220468_3340973282538731408_3340973282538731408_ejpbbhjlbipncjklfjjaedaieimbmdda(data) { conduitPage.sendRequest('CT3220468', '3340973282538731408','callBackToAppThroughAppToTabCommunication_0.9277440786827356', data); }</script><script>if (window.addEventListener) { var callback_func = function(evt) { if ('undefined' != typeof evt.target && "A" == evt.target.nodeName) { var url = evt.target.href; EBCallBackMessageReceived_CT3220468_3340973282538731408_3340973282538731408ejpbbhjlbipncjklfjjaedaieimbmdda(url); } return true; }; var cb_add_listener_result_click = window.addEventListener('click', callback_func, true); var cb_add_listener_result_contextmenu = window.addEventListener('contextmenu', callback_func, true); } else if (document.attachEvent) { var callback_func = function () { if ('undefined' != typeof event.srcElement &&'A' == event.srcElement.tagName) { var url = event.srcElement.href; EBCallBackMessageReceived_CT3220468_3340973282538731408_3340973282538731408__ejpbbhjlbipncjklfjjaedaieimbmdda(url); } return true; }; var cb_add_listener_result_click = document.attachEvent('onclick', callback_func); var cb_add_listener_result_contextmenu = document.attachEvent('oncontextmenu', callback_func); }
</script></head> <body>
<div class="header">
<div class="wrapper">
<h1 class="branding-title"><a href="./">Shirts 4 A Cause</a></h1>
<ul class="nav">
<li class="shirts on"><a href="shirts.php">Shirts Catalog</a></li>
<li class="contact "><a href="contact.php">Contact Us</a></li>
>
<li class="cart "><a href="cart.php">Shopping Cart</a></li>
</ul>
</div>
</div>
<div id="content">
<div class="section page">
<div class="wrapper">
<div class="breadcrumb"><a href="shirts.php" <a=""> > Mike the Frog Shirt, Blue</a></div><a href="shirts.php" <a="">
<div class="shirt-picture">
<span>
<img src="img/shirts/shirt-103.jpg" alt="Mike the Frog Shirt, Blue">
</span>
</div>
<div class="shirt-details">
<h1><span class="price">$20</span> Mike the Frog Shirt, Blue
<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="JDXZERKTEAC9Y">
<input type="hidden" name="item_name" value="Mike the Frog Shirt, Blue">
<table>
<tbody><tr>
<th>
<input type="hidden" name="on0" value="Size">
<label for="on0">Size</label>
</th>
<td>
<select name="os0" id="on0">
<option value="Small">Small </option>
<option value="Medium">Medium </option>
<option value="Large">Large </option>
<option value="X-Large">X-Large </option>
</select>
</td>
</tr>
</tbody></table>
<input type="submit" value="Add to Cart" name="submit">
</form>
<p class="note-designer">ipsum Aenean dignissim, enim quis varius tempor, magna mauris venenatis</p>
</h1></div>
</a></div><a href="shirts.php" <a="">
</a></div><a href="shirts.php" <a="">
</a><div class="footer"><a href="shirts.php" <a="">
</a><div class="wrapper"><a href="shirts.php" <a="">
</a><ul><a href="shirts.php" <a="">
</a><li><a href="shirts.php" <a=""></a><a href="#">Twitter</a></li>
<li><a href="#">Facebook</a></li>
</ul>
<p>©2013 Shirts 4 Cause LLC</p>
</div>
</div></div><div class="SkipThisFixedPosition main-iframe-wrapper" id="main-iframe-wrapper" style="display:block !important; width:100%; height:35px; position:fixed; top:0px; left:0px; line-height:0; z-index:2147483646;" background="chrome-extension://ejpbbhjlbipncjklfjjaedaieimbmdda/screenShot.png"><iframe class="TOOLBAR_IFRAME" id="0.4335473880637437" frameborder="0" scrolling="no" extensionid="ejpbbhjlbipncjklfjjaedaieimbmdda" style="width: 100%; line-height: 0; position: absolute; left: 0px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgba(0, 0, 0, 0.294118); height: 35px !important; visibility: visible !important; margin: 0px !important; display: inline; top: 0px !important;" src="chrome-extension://ejpbbhjlbipncjklfjjaedaieimbmdda/js/iframeHost.html#viewId=0.4335473880637437&pageHostReady" ctid="CT3220468"></iframe></div><div id="mainContainerSB_CTID" style="width: 100%; display: block !important;"><div id="popupsFixedDiv" class="popupsFixedDivClass SkipThisFixedPosition" style="left:0px; height:0px; top:0px; z-index:2147483646; position:fixed; overflow:visible;"></div></div></body></html>

Randy Hoyt
Treehouse Guest TeacherHmmm ... that code actually works for me. Clicking Add to Cart adds the shirt to a PayPal shopping cart in a new tab successfully.
I wonder if the inspector is manipulating the code somehow. Could you try right-clicking on the page, selecting View Source, and copy and pasting that source?

Justin Enayati
2,985 Pointshey randy sure,
sorry for some reason i meant to copy and page the view source not the page element.
<html> <head> <title></title> <link rel="stylesheet" href="css/style.css" type="text/css"> <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Oswald:400,700" type="text/css"> <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" /> </head> <body>
<div class="header">
<div class="wrapper">
<h1 class="branding-title"><a href="./">Shirts 4 A Cause</a></h1>
<ul class="nav">
<li class="shirts on"><a href="shirts.php">Shirts Catalog</a></li>
<li class="contact "><a href="contact.php">Contact Us</a></li>
>
<li class="cart "><a href="cart.php">Shopping Cart</a></li>
</ul>
</div>
</div>
<div id="content">
<div class="section page">
<div class="wrapper">
<div class="breadcrumb"><a href="shirts.php"<a/> > Mike the Frog Shirt, Blue</div>
<div class="shirt-picture">
<span>
<img src="img/shirts/shirt-103.jpg" alt="Mike the Frog Shirt, Blue">
</span>
</div>
<div class="shirt-details">
<h1><span class="price">$20</span> Mike the Frog Shirt, Blue
<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="JDXZERKTEAC9Y">
<input type="hidden" name="item_name" value="Mike the Frog Shirt, Blue">
<table>
<tr>
<th>
<input type="hidden" name="on0" value="Size">
<label for="on0">Size</label>
</th>
<td>
<select name="os0" id="on0">
<option value="Small">Small </option>
<option value="Medium">Medium </option>
<option value="Large">Large </option>
<option value="X-Large">X-Large </option>
</select>
</td>
</tr>
</table>
<input type="submit" value="Add to Cart" name="submit">
</form>
<p class="note-designer">ipsum Aenean dignissim, enim quis varius tempor, magna mauris venenatis</p>
</div>
</div>
</div>
<div class="footer">
<div class="wrapper">
<ul>
<li><a href="#">Twitter</a></li>
<li><a href="#">Facebook</a></li>
</ul>
<p>©2013 Shirts 4 Cause LLC</p>
</div>
</div>
im glad to hear that the page works properly for you on your browser. i tried clearing my cache and browser history(thought maybe my cookies was altering the link) but unfortunately , that didnt seem to to do the trick,
thanks again for the help !

Justin Enayati
2,985 PointsHey Randy,
Just wanted to add: this seem to be an issue with the Google chrome browser. not sure if its only my browser or just with chrome in general.
i decided to try to access my host by using IE, and with no problems at all the page didn't jump, and took me directly to the correct Paypal page.
so as you stated the code is correct and running. i am assuming that your using Safari ( based on the tutorials) , so I'm not sure if this info helps or worsens the issue.
i still would love a fix of this issue if you can, i don't want chrome users not to be able to access my page without any flaws.
Thanks again Randy

Randy Hoyt
Treehouse Guest TeacherActually, I'm using Chrome as well. Perhaps the problem is related to you having the Chrome Inspector open? Try this:
- Open a new window in incognito mode. (CMD+SHIFT+N on Mac OS X)
- Browse to the correct page.
- Click Add to Cart.
What's the outcome with that?

Justin Enayati
2,985 PointsThanks Randy,
No this didn't seem to do the trick.
I just don't get it, to be honest it seems like the entire details section is being put in an anchor tag and directing back to the shirts.php page.
i really appreciate the help though, any other suggestions ? Hopefully we'll figure this out.

Randy Hoyt
Treehouse Guest TeacherDo you have a server somewhere that you could FTP the code? I'd love to type a web address in my browser and see that same web page that you are seeing.

Justin Enayati
2,985 Pointssure Randy, that's not a problem
i have set you up with a username and password to access my server.
do you have a private way of contacting you, i can send you the link and close the the access after the problem is solved.
thanks and again much appreciated.

Randy Hoyt
Treehouse Guest TeacherCan just point me at a public web address? I shouldn't need that level of access to your server: I should be able to see the problem in the generated HTML.

Justin Enayati
2,985 Pointsrandy sorry i didnt mean im giving you access to the actual server. the site is password protected. and that was your access to the site.
you can access the "public" @ justin.seriesgate.com

Randy Hoyt
Treehouse Guest TeacherAh, got it! :~)
You can send an email to help@teamtreehouse.com with the credentials for that, and I'll have access to them. (Just mention in the email that the credentials are for me.)

Justin Enayati
2,985 PointsGotcha! Will do asap. This is only a temp cred and i will be removing access after 24 hours. so if the password doesn't work, let me know and i will reset it for you.

Randy Hoyt
Treehouse Guest TeacherHmmm ... that password doesn't seem to be working. Could you try again?

Randy Hoyt
Treehouse Guest TeacherI can get into the site, but I'm getting an error when I view a page like this:
Can you post a web address here that should work so I can see the Add to Cart button?

Justin Enayati
2,985 PointsHey Randy, so sorry for that error. i was trying to move ahead into the redirect of the shirt page. so as im sure you noticed that was just the next step in the tutorial.
i have taken out the logic for that error and the cart should be accessible now.
let me know if you have any further questions or problems accessing the page!
thanks again!
P.s - what if i was to say i think the error and the jump back of the link might be due to the breadcrumb link that jumps back to the shirts page. (just my guess)

Randy Hoyt
Treehouse Guest TeacherEverything works just fine for me in Google Chrome: I click the button, and a new tab opens to PayPal with the shirt added to the cart.
I wonder, do you have a pop-up blocker plugin of some kind installed?

Justin Enayati
2,985 PointsHey Randy,
No i have no pop up blocker or any additional software that is giving me this issue.
essentially (at least on my end) the entire section seems to be an anchor tag.
i can click on the image, i can click on the <p> element text, and i can click on the actual selector of the sizes, and in doing so each action takes me directly back to the shirts page.
the only button that seems to work is the actual add to cart button, which directs me to paypal the right way. problem is i cant alter the size or click on anything on the page details section without being redirected back to shirts.php
the only href i can think of that is directing me is the breadcrumb ??
<div class="breadcrumb"><a href="shirts.php"<a/> > <?php echo $product["name"]; ?></div>
I'm glad to see this is only as issue for me, and not so much my code, but in saying that it makes it even more confusing as to why my browser hates me.

Justin Enayati
2,985 PointsHey Randy,
That was it right there ! the issue was what i feared
<div class="breadcrumb"><a href="shirts.php"<a/> > <?php echo $product["name"]; ?></div>
missed the closing anchor ">" between the open <a> and closing </a>
thanks so much for your help, I'm glad it was just a simple error on my part.
keep up the great work on the vids

Randy Hoyt
Treehouse Guest TeacherGood find! That's strange that it was working for me in Chrome and working for you in other browsers. Glad you got it fixed.
(Also, I'm glad you are enjoying the videos. Thanks for the feedback! :~)