I'm quiet basic user of php & sql and wanted to do a shopping cart system I need your help for this script.
The result is all the list from the table is displayed from the page and i wanted to to have a popup page where if you click one of the product it will display from the popup
If you notice i added an anchor tag as this is the link which leads to a popup page the popup information is still under one page:
`
<table width="800px" border="0" cellpadding="0" cellspacing="7">
<? $result=mysql_query("select * from argentina");
while($row=mysql_fetch_array($result)){ ?>
<tr>
<td align="center" valign="top"><img src="../user/<?=$row["picture"]?>" height="130" /></td>
<td align="right" valign="top" bgcolor="#E0E0E0">
<table width="100%" border="0" cellspacing="0" cellpadding="15">
<tr>
<td width="78%" valign="top"><a class="inline" href="#inline_content"><strong><?=$row["name"]?></strong></a><br />
Variety: <?=$row["variety"]?> <br />
Apellation: <?=$row["apellation"]?> <br />
<td width="22%" valign="top"><?=$row["content"]?><br /><br /><br />
<input type="button" class="button-order" value="Order Now" href="contactus.php" />
//windpoppup
<div style="display:none">
<div id="inline_content" style="padding:10px;background:#fff;">
<p>
//Please provide code here
</div>
</p>
</div></div>
<p></td> </tr><br>
</table><br>
</td></tr><br>
<tr><td colspan="0"></td><? } ?><br>
</table></p>
</pre>
`
Thanks.
I would suggest you take a look at Codeigniter's Cart Class which is already well written. There is not much need to keep reinventing the wheel, but you can do so by reading their core if you wish :)
Cart Class (Obviously, you can do shopping cart with it, lots tutorial available if you do some research
Related
I am trying to add an option in the backend of an administration panel where admins can change the user type. Called: Change User Type
Before these were the options available: Add Notes about Driver and Change Email :
I modified the php and added the front end selector to Change user type in the admin panel:
But the problem is that it keeps pulling a box to enter data. I want a list with all user types to be listed in a drop down so I can select a user type and change and not add notes to it.
In the database I only have three types of users "user_group". They are listed under Ids 1, 2, and 3.
MY QUESTION IS:
How can I make a drop down list appear, once I select Change User Type after already having selected the user under the Select Driver options in the previous drop down?
My user type ids are listed under user_group
Below is the current code on the file, which is not very much:
function fn_ACTION_METHOD(sMethod){
if(sMethod=='notes'){
document.getElementById('comment_box').style.display='block';
document.getElementById('email_box').style.display='none';
document.getElementById('btnSUBMIT').value='ADD NOTES';
}else if(sMethod=='email'){
document.getElementById('comment_box').style.display='none';
document.getElementById('email_box').style.display='block';
document.getElementById('btnSUBMIT').value='CHANGE EMAIL';
}else if(sMethod=='user_group'){
document.getElementById('comment_box').style.display='none';
document.getElementById('email_box').style.display='block';
document.getElementById('btnSUBMIT').value='ChangeType';
}
}
function fn_LOAD_EMAIL(iDriverID){
$.get("ajax_data.php", {action: 'load-email', did: iDriverID}, function(data){
if (data=="ERROR"){
$('#Message').html("Error!!! in loading driver email");
}else{
$('#txtemail').val(data);
}
}, 'html');
}
</script>
</head>
<body style="margin: 0px;">
<div align="center">
<table border="0" cellspacing="0" cellpadding="0">
<!--start header -->
<? include('inc_header.php'); ?>
<!-- start side nav -->
<!-- actual page -->
<td>
<table border="0" cellspacing="0" cellpadding="0" width="980">
<tr valign="top" align="left">
<td width="15" height="16"><img src="../assets/images/autogen/clearpixel.gif" width="15" height="1" border="0" alt=""></td>
<td width="1"><img src="../assets/images/autogen/clearpixel.gif" width="1" height="1" border="0" alt=""></td>
<td width="949"><img src="../assets/images/autogen/clearpixel.gif" width="683" height="1" border="0" alt=""></td>
<td width="15"><img src="../assets/images/autogen/clearpixel.gif" width="1" height="1" border="0" alt=""></td>
</tr>
<tr valign="top" align="left">
<td height="40"></td>
<td colspan="2" width="949">
<table border="0" cellspacing="0" cellpadding="0" width="949" style="background-image: url('../assets/images/banner.png'); height: 40px;">
<tr align="left" valign="top">
<td width="100%">
<table border="0" cellspacing="0" cellpadding="0" width="100%" height="100%">
<tr>
<td class="TextObject" align="center">
<h1 style="margin-bottom: 0px;">DRIVER NOTES & EMAIL CHANGE</h1>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr valign="top" align="left"><td colspan="4"> </td></tr>
<tr valign="top" align="left"><td colspan="4"> </td></tr>
<tr valign="top" align="left">
<td colspan="2"></td>
<td width="1050" class="TextObject" align="center">
<form name="frm1" action="driver_notes_email.php" method="post">
<input type="hidden" name="action" value="add_action" />
<table cellpadding="0" cellspacing="5" border="0" width="800" align="center" class="box">
<tr><td colspan="2" id="Message" width="100%"><?=$sMessage?></td></tr>
<tr>
<td class="label" width="200">Driver:</td>
<td width="800"><? fn_DISPLAY_USERS('drpdriver', 0, "200", "1", "--Select Driver--", "CONCAT(l_name, ' ', f_name) AS user_name", "l_name", $iGROUP_DRIVER.",".$iGROUP_COORDINATOR_STAFF, "fn_LOAD_EMAIL(this.value);");?></td>
</tr>
<tr>
<td class="label">Action:</td>
<td>
<div class="left"><input type="radio" id="opttype" name="optaction" value="ChangeType" onClick="fn_ACTION_METHOD('notes');"/></div>
<span class="label left">Change User Type</span>
<div class="left"><input type="radio" id="optnotes" name="optaction" value="Notes" onClick="fn_ACTION_METHOD('notes');"/></div>
<span class="label left">Add Notes about Driver</span>
<input type="radio" id="optreading" name="optaction" value="Change Email" onClick="fn_ACTION_METHOD('email');"/>
<span class="label">Change Email</span>
</td>
</tr>
<tr>
<td colspan="2">
<div id="email_box" style="display:none;">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td class="label" width="200">Email:</td>
<td width="400"><input type="text" id="txtemail" name="txtemail" value="" maxlength="150" style="width:250px;" /></td>
</tr>
</table>
</div>
</td>
</tr>
<tr>
<td colspan="2">
<div id="comment_box" style="display:none; width:100%;">
<table cellpadding="0" cellspacing="5" border="0" width="100%">
<tr>
<td class="label" valign="top" width="200">Notes:</td>
<td width="400"><textarea name="txtcomments" id="txtcomments" cols="50" rows="10" style="width:250px;" ></textarea></td>
</tr>
</table>
</div>
</td>
</tr>
<tr><td colspan="2"> </td></tr>
<tr><td></td><td><input type="button" name="btnSUBMIT" id="btnSUBMIT" value="ACTION" class="Button" onClick="valid_action(this.form);" style="width:150px;" /></td></tr>
</table>
</form>
</td>
<td></td>
</tr>
</table>
</td>
<!-- end actual page -->
<!-- footer -->
<? include('inc_footer.php'); ?>
</table>
</td>
</tr>
</table>
</div>
</body>
</html>
Look in your html code where the div id equals email_box. This box is already on the page but is hidden. In your javascript you added for the 'change user type' you correctly changed the action button but you are still just showing the email_box div by calling style display = block
You need to add a new div which is hidden by default with a select box in it, and only show it when the radio button is clicked. You will also need to add your php code in to actually update the user when the form is submitted.
I understand that the question is little bit vague. Still I am tempted to ask this. I will give one working example and would like to know, how I can use this in my project. There is a site called http://erail.in .In this, if I want to get the details of a train or PNR, just enter in the form and submit. This (I assume) opens the train or PNR search page of Indian Railways (probably in the background) and get details pertaining to the value given by me and display the result in the page in which I am.
Similar way I have a form in my page which has one input box for entering TLD No.
<html>
<head>
<title>Untitled Document</title>
<link href="/DatePicker.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jquery-1.5.1.js"></script>
</head>
<body>
<form>
TLD No.<input type="text" id="tip"/>
<input type="submit" id="submit" value="Get" />
</form>
</body>
</html>
Upon submitting this form , I need a jQuery script which opens another search page in another server and submit the form in that page get the result from that page to my script. The search page in that server is like this:
<html>
<head>
<title>INDIVIDUAL ALL REPORT</title>
<base target="_self">
</head>
<body >
<form method="POST" name="form1" action="../dbms/allindvres.asp" target="I1">
<table border="0" cellpadding="0" cellspacing="0" style="BORDER-COLLAPSE: collapse" bordercolor="#669999" width="100%" id="AutoNumber1" >
<tr>
<th width="100%" colspan="4" style="BACKGROUND-COLOR: #cc6600; COLOR: #ffffff; FONT-WEIGHT: bold; TEXT-TRANSFORM: uppercase">individual data in one click</th>
</tr>
<tr>
<td width="33%" height="22" align="middle" ><font size=4>TLD No <input name="TLDNO" size="10"></td>
<td width="33%" height="22" align="middle" ><font size=4>CC No <input name="CCNO" size="10"></td>
<td width="33%" height="22" align="middle"><font size=4>or Name <input name="name" size="30"></td>
<td width="33%" height="22" align="middle">
<p align="center"><input type="submit" value="Get Life Dose" name="B1"></p>
</td>
</tr>
</table>
</form>
<iframe name="I1" width="100%" height="500" src="../DBMS/allindvres.asp" marginwidth="10" marginheight="5">
Your browser does not support inline frames or is currently configured not to display inline frames.</iframe></p></p>
</body>
</html>
Once the form is submitted, the result is displayed in the iframe above. The resulting html will look like this
<html>
<head>
<body>
<h3 align = 'center'><font color="red">
OTHER STATION
</h3>
<table border="2" align = 'center' cellpadding="0" style="border-collapse: collapse" width="80%" id="AutoNumber2">
<tr>
<TD WIDTH = 85% align = 'left' colspan='3'>
<table border="0" align = 'center' cellpadding="0" width =100%>
<tr>
<td>CC NO:</td>
<td>xxx</td>
<Td>SECTION: </td>
<td>xxx</td>
</tr>
<tr>
<td>NAME: </td>
<td>XXXX </td>
<Td>CATEGORY: </td>
<td>XX</td>
</tr>
<tr>
<td>FATHER'S NAME:</td>
<td>XXXX</td>
<Td>EMP NO: </td>
<td>XXXXX</td>
</tr>
<tr>
<td>BIRTH PLACE </td>
<td>XXXXX</td>
<td>CC NO:</td>
<td>XXXX</td>
</tr>
<tr>
<td>STATE</td>
<td>XXXXX</td>
<td>DATE OF BIRTH</td>
<td>3thMay1968</td>
</tr>
<tr>
<td>QUALIFICATION: </td>
<td>XXXX</td>
<td>DESIGNATION: </td>
<td>XXXX</td>
</tr>
</table>
</body>
</html>
I want to get values in second of second from the above table and display it in my page. How can I accomplish this?
If I am using the action="http://anotherserver/dbms/allindvres.asp" in the form above, After submitting I can get the result in an I frame in my page. But I do not want to use the default form submit method which refreshes the page. That is why I use jQuery. Any work around?
I know how to provide or modify a field with CURL curl_setopt function and to work with cookies, but what I could not find is how to modify an HTML element with CURL.
For instance, let's say I want to replace the function "submit_device_form" in below code
<div id="bottombuttons">
<table border="0" cellspacing="0" cellpadding="0" style="width:100%;">
<!-- buttons -->
<tr>
<td> </td>
<td class="separatorButton">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td>Set</td>
<td>Cancel</td>
</tr>
</table>
</td>
</tr>
<!-- fixes the width of the first column -->
<tr>
<td style="padding:0;"><img src="images/spacer.gif" alt="" width="200" height="1" border="0" ></td>
<td style="padding:0;"><img src="images/spacer.gif" alt="" width="360" height="1" border="0" ></td>
</tr>
</table>
</div>
with "submit_MY_form", a new JavaScript function included in my PHP script. How would I go for it?
I looked into the "PHP Simple HTML DOM Parser" library since it provides the setAttribute and removeAttribute functions that would allow me to do that easily, but then I miss the info on how to give it access to the page read wia CURL, so I'm stuck.
Thanks for your help,
Robert
I've been editing my MyBB portal.php, and up until recently it was displaying fine. I had added a custom welcome block above the recent posts, and it was displaying fine.
Today I went in to tidy up the code, adding new lines (enter) and indents to make the code more legible. Now, after doing this something went badly wrong. Instead of showing the full MyBB page styles, all it shows is the tags like {$header}. Here's the code:
<html>
<head>
<title>{$mybb->settings['bbname']}</title>
{$headerinclude}
</head>
<body>
{$header}
<table width="100%" cellspacing="0" cellpadding="{$theme['tablespace']}" border="0" align="center">
<tr><td valign="top" width="200">
{$welcome}
{$pms}
{$search}
{$stats}
{$whosonline}
{$latestthreads}
</td>
<td> </td>
<td valign="top">
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<tr>
<td class="trow1">
<span class="smalltext">
<!--Main Welcome Panel-->
<p style="text-align: center;">
<img alt="" src="http://axelcraft.net/images/welcome.png" style="width: 1024px;" /></p>
<p style="text-align: center;">
<span style="color:#696969;"><span style="font-size: 24px;"><em><span style="font-family: hutrmold;">Get ready for a whole new minecraft experience.</span></em></span></span></p>
<!--Slideshow-->
<center>
<iframe src="http://axelcraft.net/images/slides/slideshow.html" width="800" height="320" scrolling="no" frameBorder="0" style="overflow:hidden;"></iframe>
</center>
<!--End Slideshow-->
<p style="text-align: center;">
<span style="font-size:20px;">
<span style="font-family: 'trebuchet ms', helvetica, sans-serif;">
Thanks for visiting AxelCraft! Start by <span style="color:#385947;"><span style="">signing up</span></span> to get the latest news and updates on the server as well as to register for <span style="color:#385947;">contests</span> and <span style="color:#385947;">events</span>!
</span>
</span>
</p>
<!--End Welcome Panel-->
</span>
</td>
</tr>
</table>
<br />
{$announcements}
</td>
</tr>
</table>
{$footer}
</body>
</html>
Now, when you navigate to portal.php, it only shows the {$} tags along with the html paragraph. It's supposed to be showing sidebars and headers left and right like MyBB does. See what I mean here.
Compare that to the normal forum page here.
I can't figure out what's wrong or why it's not displaying properly.
I could be wrong but are you missing an '>' here
<tr><td
<table width="100%" cellspacing="0" cellpadding="{$theme['tablespace']}" border="0" align="center">
<tr><td valign="top" width="200">
i have one php code for button creation
for($i=1;$i<=$n;$i++)
{
$row=mysql_fetch_array($result);
if($row['btn_color']==1)
$btbg="side-button5.png";
if($row['btn_color']==2)
$btbg="side-button6.png";
if($row['btn_color']==3)
$btbg="side-button7.png";
if($row['btn_color']==4)
?>
<br>
<table width="200" height="50" border="0" cellpadding="0" cellspacing="0">
<tr>
<td background="images/<?php echo $btbg ; ?>" style="background-repeat:no-repeat"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="66">
<div align="center" class="buttonside">
<p>
<a class="buttonside" href="vpa.php?pgid=<?php echo $row['page_id']; ?>">
<?php echo $row['btn_text']?></p>
</a>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
<?php
}
?>
this code is working fine but the link is on text, i want to put link on full button(background)
Thanks
To make the button 'linkable', you'll need to wrap the <a> tag around it.
However, you're going to need to change your HTML markup structure - you can't wrap an anchor around a table cell!