I am trying to read information from a css-styled web page and send it to a PHP script to be handled. However I can not figure how to do it.
This is the menu button located on the page
<ul class="vmenu">
<li> <span class="l"></span><span class="r"></span><span class="t">Group 1</span> </li>
<li> <span class="l"></span><span class="r"></span><span class="t">Group 2</span> </li>
</ul>...
and this is how I am trying to do it, but it changes it to a visible button and does not fit the styling.
<form name="sidemenu" action="index.php" method="post">
<ul class="vmenu">
<?php while (!empty($categoryname[$categointeger])) { ?>
<li> <input type="submit" name="categoryname" class="button" value="<?php echo"$cateid[$categointeger]"?>"></li>
<?php } ?>
</ul>
</form>
How can I read the information without touching the styling of the page and not using <a href="#">.
Related
Here's my HTML code:
<li>
<a href="#" data-toggle="modal" data-target="#myModal">
<span>Get_Right| $180.000<span>
</a>
</li>
And here's what I need:
When I click the "Get_Right" I want to assign a PHP variable to the name, something like $name = "Get_Right", I have tons of these li's about 50, how can I do it for one so I can replicate it for the other ones aswell?
You can use the following code.
<?php
if(isset($_POST['button1'])){
echo "$180.000";
}
?>
<!--
<li>
<a href="#" data-toggle="modal" data-target="#myModal">
<span>Get_Right| $180.000<span>
<input type="text" name="button1" value="Get Right">
</a>
</li> -->
<form action="resolve.php" method="POST">
<input type="submit" name="button1" value="Get Right">
</form>
I hope that helped you or at least give you a ideea to make.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
Okay so what I am after for here is to check if a checkbox has been ticked, if it has, then I would like to add the text into a <ul> class named, let's say, "confirmed", so <ul class="confirmed">,
If it hasn't been checked, then I would add the text to a <ul> class named "unconfirmed". Now I have the php code that checks if the checkbox has been confirmed (seen below), but I don't know what to add inside the statements. This is where I need help/guidance.
PHP IF code (Check if checkbox is ticked):
<?php
if (isset($_POST["checkbox1"])){
//write to <ul> class confirmed
} else {
//write to <ul> class unconfirmed
}
?>
Here's my HTML Code:
<body>
<div id="content">
<div class="jumbotron">
<h1>Is there football on Wednesday?</h1>
<h2>Yes.</h2>
</div>
<div class="alert alert-info" role="alert">Confirmed Players</div>
<ul class="list-group">
<li class="list-group-item">
<!--this is where to result of the php code would go if the checkbox is checked-->
Lorem Ipsor
</li>
</ul>
<div class="alert alert-danger" role="alert">Unconfirmed Players</div>
<li class="list-group-item">
<!--this is where to result of the php code would go if the checkbox is not checked-->
Lorem Ipsor
</li>
</div>
<!--form-->
<form action="check.php" method="POST">
<input type="checkbox" name="checkbox1">
<input type="submit"></input>
</form>
</body>
Sorry if I seem to be confusing you, as I said, I'm not too well. Any help/guidance would be great!
Alright so when you tick a checkbox it should return a value through the $_POST which is 1 or 0 on submit. You may modify your template like this:
<?php
if ($_POST['checkbox1']) {
$class = 'confirmed';
}
else {
$class = 'unconfirmed';
}
?>
<body>
<div id="content">
<div class="jumbotron">
<h1>Is there football on Wednesday?</h1>
<h2>Yes.</h2>
</div>
<div class="alert alert-info" role="alert">Confirmed Players</div>
<ul class="list-group <?php echo $class; ?>">
<li class="list-group-item">
Lorem Ipsor
</li>
</ul>
<div class="alert alert-danger" role="alert">Unconfirmed Players</div>
</div>
<!--form-->
<form action="check.php" method="POST">
<input type="checkbox" name="checkbox1" />
<input type="submit" />
</form>
</body>
To be sure you can always var_dump the $_POST to see what is coming through in it and modify your if statement to be more accurate, it should return 1 or 0 iirc.
Without using AJAX you can try nesting php code like this:
<ul class="list-group">
<li class="list-group-item">
<?php
if (isset($_POST["checkbox1"])){
//write to <ul> class confirmed
}
?>
</li>
</ul>
<div class="alert alert-danger" role="alert">Unconfirmed Players</div>
<li class="list-group-item">
<?php
if (!isset($_POST["checkbox1"])){
//write to <ul> class unconfirmed
}
?>
</li>
sorry if this is a bit vague although I really don't know how to explain this one.
Basically I already have a listing page that lists all of the rows in my database into a html template that lists each row into an eCommerce style category page using PHP.
I am using this code for the listing page using PDO:
<?php while($row = $results->fetch(PDO::FETCH_ASSOC))
{
echo '
<div class="listing-container">
<h3 class="model-listing-title clearfix">'.$row["Make"].' '.$row["Model"].' '.$row["Variant"].'</h3>
<h3 class="price-listing">£'.number_format($row['Price']).'</h3>
</div>
<div class="listing-container-spec">
<img src="'.(explode(',', $row["PictureRefs"])[0]).'" class="stock-img-finder"/>
<div class="ul-listing-container">
<ul class="overwrite-btstrp-ul">
<li class="diesel-svg list-svg">'.$row["FuelType"].'</li>
<li class="saloon-svg list-svg">'.$row["Bodytype"].'</li>
<li class="gear-svg list-svg">'.$row["Transmission"].'</li>
<li class="color-svg list-svg">'.$row["Colour"].'</li>
</ul>
</div>
<ul class="overwrite-btstrp-ul other-specs-ul h4-style">
<li>Mileage: '.number_format($row["Mileage"]).'</li>
<li>Engine size: '.$row["EngineSize"].'cc</li>
</ul>
<button href="#" class="btn h4-style checked-btn hover-listing-btn"><span class="glyphicon glyphicon-ok"></span> History checked
</button>
<button href="#" class="btn h4-style more-details-btn hover-listing-btn tst-mre-btn"><span class="glyphicon glyphicon-list"></span> More details
</button>
<button href="#" class="btn h4-style test-drive-btn hover-listing-btn tst-mre-btn"><span class="test-drive-glyph"></span> Test drive
</button>
<h4 class="h4-style listing-photos-count"><span class="glyphicon glyphicon-camera"></span> 5 More photos</h4>
</div>
';
} ?>
</div>
Now what I want to do is create a page for each of the SQL rows however I am unsure how I can do this, just like an eBay product page really.
My main question is what method could I do to create individual pages that are dedicated to each SQL row?
If anyone could shed a bit of light on this for me it would be much appreciated.
Knowing you can extract data from a page to another using $_POST['name-of-your-element'], I would say to do something like this :
Creating a php page dedicated to display information of one specific row
Putting some $_POST['...'] call to display the exact data
To do this, instead of just displaying your row in your actual page, you should create form for each row, and then adding a submit button for each row which will launch the "display row page" with the correct information. I would see something like this for each row :
<form method = "post" action = "displayData_Make.php">
<div id = "Make" name = "Make">
Make : <?php echo $row['Make'] ?>
</div>
<input type = "submit" value = "more information..." />
</form>
Then in you "displayData_Make.php" receive your information and display them like you want :
<?php
$info = $_POST['Make'];
// Do what you want with this data
// Display, etc...
?>
<!--
Some html code
-->
I have this open source project, written in php, and I am trying to modify the code. I added some tabs and I want to load a form when a tab is selected. The project is OpenEMR.
<?php
if($focustype=='allergy'){
?>
<div id="container">
<ul class="tabNav">
<li class="current">Medical Implants</li>
</ul>
<div class="tabContainer">
<div class="tab current">
<p><a id="cod2" onclick="return loadFrame2('cod2','RBot','patient_file/encounter/load_form.php?formname=LBFclinicalPD')" href="" style="color: rgb(0, 0, 0);">Patient Clinical Data</a><p>
</div>
</div>
</div>
<?php
The problem is that it doesn't work. It seems to be loading for a second and then nothing.
Thank you in advance
Try this:
<a id="cod2" onclick="loadFrame2('cod2','RBot','patient_file/encounter/load_form.php?formname=LBFclinicalPD');return false;" href="#" style="color: rgb(0, 0, 0);">Patient Clinical Data</a>
I am creating a sorting page, which will show content of database, and the user can sort it with listjs. Problem is that when i press any button, the content loaded from the database disappears. When I fill the content manually it works great. Can anybody please help me with this problem?
My load function:
$(document).ready(function(){
$(".list").load("../wp-content/php/sorting.php");
});
sorting.php
<?php
mysql_connect("***", "***", "**") or die(mysql_error());
mysql_select_db("***");
$result = mysql_query("SELECT * FROM business");
while($row = mysql_fetch_array($result))
{
?><li class="onebusiness"><a href="<?php
echo $row['link'];?>"><img src="<?php
echo $row['img'];?>" height="125" width="125"/><p class="name"><?php
echo $row['name'];?></p><p class="category" style="display:none;"><?php
echo $row['category'];?></p></a></li><?php
}
mysql_close();
?>
HTML:
<script src="../wp-content/js/filter/call-php.js" type="text/javascript"></script>
<script src="../wp-content/js/list/list-min.js" type="text/javascript"></script>
<div id="busineseslist">
<input class="search" placeholder="Search Business" />
<ul class="sort-by">
<li class="sort btn" data-sort="name">Sort by name</li>
<li class="sort btn" data-sort="category">Sort by category</li>
</ul>
<ul class="filter">
<li class="btn" id="filter-none">Show all</li>
<li class="btn" id="filter-something">Only show something</li>
<li class="btn" id="filter-else">Only show something else</li>
</ul>
<div class="list"></div>
</div>
Why you dont just do this:
<script src="../wp-content/js/filter/call-php.js" type="text/javascript"></script>
<script src="../wp-content/js/list/list-min.js" type="text/javascript"></script>
<div id="busineseslist">
<input class="search" placeholder="Search Business" />
<ul class="sort-by">
<li class="sort btn" data-sort="name">Sort by name</li>
<li class="sort btn" data-sort="category">Sort by category</li>
</ul>
<ul class="filter">
<li class="btn" id="filter-none">Show all</li>
<li class="btn" id="filter-something">Only show something</li>
<li class="btn" id="filter-else">Only show something else</li>
</ul>
<div class="list"><?php include '../wp-content/php/sorting.php'; ?></div>
</div>
With this you can delete this line:
<script src="../wp-content/js/filter/call-php.js" type="text/javascript"></script>//delete this
Which i think its the js with the following code:
$(document).ready(function(){
$(".list").load("../wp-content/php/sorting.php");
});
Because with the php include you dont need the load function ;)
------------------------EDITED----------------------------------------
In wordpress, you can include files in this way:
Put the include files in your theme folder and use this in your theme's footer.php:
<?php include (TEMPLATEPATH . '/sorting.php'); ?>
See this reference link: http://www.deluxeblogtips.com/2010/06/wordpress-include-template-files.html
Your div should looks like:
Go to the 'Theme Editor', look for the file that generates the html. Edit it and place this code between the divs tags:
<div class="list"><?php include (TEMPLATEPATH . '/sorting.php'); ?></div>
Saludos.