<?php $picNumberSlide = "<div id='slidenumber'></div>" ;?>
Num Print
<div id="slidenumber"></div> -> (Picture slide number)
Link
<a href="share?picNum=<?php echo $picNumberSlide;?>">
Not work.
<div id='slidenumber'></div> slide number of the screen writes.
I intended to write inside the URL's
How i can do? Thank you!
(i sorry for Eng)
<?php $picNumberSlide = "<div id='slidenumber'></div>" ;?>
The above defines the $picNumberSlide variable as a div.
<a href="share?picNum=<?php echo $picNumberSlide;">
Here you are placing a div inside the href of an anchor, that will never work.
You need to assign the $picNumberSlide variable only the number you wish to use.
Then using
<a href="share?picNum=<?php echo $picNumberSlide; ?>">
will work.
$picNumberSlide should only = a number
Change <a href="share?picNum=<?php echo $picNumberSlide;">
To <a href="share?picNum=<?php echo $picNumberSlide;?>">
(You were missing the closing tag for php)
Related
Im trying to send the patient ID through a hyperlink, tho while it redirects to the correct page it is not sending the information.
<a href="./patientrecord.php?patient_id="<?php $row["patient_id"]?>><?php echo $row["surname"];?></a>
Please make sure you are going to echo the variable
Echoing a variable:
<?= $echoable_variable_here ?> // Use <?= ?> tags
or
<?php echo $echoable_variable_here ?> // Use echo inside <?php ?> tags
Edit: You have placed echo outside the href attribute tag
Therefore,
Change this:
<a href="./patientrecord.php?patient_id="<?php $row["patient_id"]?>><?php echo $row["surname"];?></a>
to:
<?php echo $row["surname"];?>
or to:
<?php echo $row["surname"];?>
I'd like to know if it's possible to open a page (id=26) at a specific position: .
At the front page i'm using this code at the php file to make the title link to the page
<a href="<?php echo get_page_link(26); ?>">
<?php if(!empty( $clean_biz_home_service_title ) ){ ?>
<h2>
<?php echo esc_html( $clean_biz_home_service_title); ?>
</h2>
</a>
Yes, you can use DOM selectors such as #maincontent. You would need to assign an ID to a section on the page and then append it to the trigger URL.
For ex: http://yourdomain.com/index.html#maincontent would take you to that div on the page.
First, in the content of that page (id=26), you need to add an id attribute to some tag, like so:
<div id="myposition">
...
</div>
Next, append #myposition after the get_page_link(26) call:
<a href="<?php echo get_page_link(26); ?>#myposition">
<?php if(!empty( $clean_biz_home_service_title ) ){ ?>
<h2>
<?php echo esc_html( $clean_biz_home_service_title); ?>
</h2>
</a>
And you are done.
<div name="position">
content
</div>
link
example:
if you click the link below you will open this page at #new-answer position
link
I have problem looping out pictures from a database.
I have no problem getting the information(string) that I need from the database. The problems accure when I try to use the string as a img src-tag.
My code:
<?php
foreach ($console as $con):
echo '<li>', $con['brand'], ', ',$con['pic'], '</li>';
echo'<div class="item2">
<a href="xboxconsol.html">
<img src=',$con['pic'],'/>
</a>
</div>';
endforeach;
?>
Note, the li-elements put out the correct information but when I use it in the img-tag it adds a "/" at the end on the string.
Example of list output:
Playstation, ../playstation.jpg
The picutre however output the URL to the pic as:
../playstation.jpg/
Where do the last "/" come from and how do I get rid of it?
You need to quote the attribute value.
echo'<div class="item2">
<a href="xboxconsol.html">
<img src="',$con['pic'],'"/>
</a>
</div>';
Currently the browser is guessing what the attribute should contain.
Which comes out as:
<img src="value/">
but you want:
<img src="value"/>
You need to quote your concatenations, be very careful how you output HTML from PHP.
I'd rather concatenate the variables like this instead:
foreach ($console as $con)
{
echo "<li>{$con['brand']} {$con['pic']}</li>";
echo "<div class='item2'>
<a href='xboxconsol.html'>
<img src=\"{$con['pic']}\" />
</a>
</div>";
}
It's way cleaner and more readable.
I'm using Drupal CMS. I'm a newbie in Drupal and PHP.
In one of my *.tpl.php file I've a PHP code snippet as follows:
<div class="form-section">
<h3>Job Alerts: jobs delivered to your inbox! <strong>(optional) </strong> <span class="info-ico"><em><?php echo bfstring('tooltip_register_job_alerts'); ?></em></span></h3>
<?php $alerts = bevforce_get_user_option($user->uid, 'alert', false); ?>
<ul class="jobs-alerts-list">
<?php foreach ($alerts as $a) : ?>
<li><?php echo $a['value']['alert_name']; ?> edit</li>
<?php endforeach; ?>
</ul>
<p><!--<a class="popup-loader" href="<?php echo url(); ?>?bf-ajax=create-job-alert&page=register"><strong>Create Job Alert</strong></a>-->
<a class="popup-loader" href="/?bf-ajax=create-job-alert&page=register">Create New Job Alert</a>
</p>
</div>
I'm not getting what's the purpose of data-oid="<?php echo $a['oid']; ?>" in anchor tag(<a>). I've never seen such attribute anywhere in <a> tag.
Following is another code snippet from my PHP code :
<li><a class="popup-loader" href="/?bf-ajax=delete-job-alert&eid=&oid=0">Remove</a></li>
If I hover the mouse cursor over the hypertext Remove, I'm getting the following URL:
xyz.com/bf-ajax=delete-job-alert&oid=3805462
How could this happen that I'm passing the value oid=0 in query string but it is showing some different value when I hover the hypertext? Is this happening due to the data-oid attribute we used in <a> tag above?
So in short my doubt is what's the purpose of attribute data-oid in <a> tag and how the value is getting changed from the value I set in the code?
Can anyone clear my above doubts?
Thanks in advance.
The data-* attribute is primarily for JavaScript in HTML 5. See: http://html5doctor.com/html5-custom-data-attributes/
Using the jQuery library, it's really easy to reference a data attribute: $("#someLink").data("name") for something like Click Me -- the .data("name") is simply for data-name.
I am using lightbox to show an image in php.
My current code:
<a class="sri" href="administrator/all_photo/mywork/
<?php
echo $res['path'];
?>
_1.jpg" rel="lightbox">
<img src="administrator/all_photo/mywork/
<?php
echo $res['path'];
?>
_1.jpg" class="photo_frame photo_size" >
<br />
<?php
echo $res['title'];
?>
</a>
CSS and JS for lightbox have already been included. In the above code, $res['title'] and $res['path'] are being fetched from database.
If I click on the image or the text which is showing as $res['title'], lightbox effect is showing. The image is within the lightbox. Now I need the $res['title'] value also be displayed when the lightbox is opened along with the image.
How do I do that?
Just use the title parameter in the <a> tag, as mentionned in the Lightbox Documentation:
Optional: Use the title attribute if you want to show a caption.
You must add the title:
<a class="sri" href="administrator/all_photo/mywork/
<?php
echo $res['path'];
?>
_1.jpg" rel="lightbox">
<img src="administrator/all_photo/mywork/
<?php
echo $res['path'];
?>
_1.jpg" title="
<?php
echo $res['title'];
?>
" class="photo_frame photo_size" >
</a>
You should be able to move all of your markup into a div. Add rel="lightbox" to that div, it should work. Although that depends on the lightbox library you are using.