PHP – Incrementing element with the same name.

558fe5180e0e8fc922d31c23ef84d240

If you download multiple files with the same name, a number is automatically added to the file name, for example: filename(1), filename(2) etc..

What I am trying to do is when I am creating a name and there is already a same one, the name I create to appear in the list as: name(1), name(2) etc.

This is the code that I use now that only creates: name and name (1), then I get this error when trying to create the next same name, example: name (1) already exists in your list., but I shouldn't get that error and should create the next name in the list: name (2) etc..

$deviceUser = "07NAV" . $var;
$sameNames = $mktApi->comm("/ppp/secret/getall", array(
    ".proplist" => ".id",
    "?name" => $deviceUser
));

$i = 0;
if($sameNames) {
    $i++;
    $mktApi->comm("/ppp/secret/add", array(
        "name" => $deviceUser . " ($i)",
        "remote-address" => $IPs[$ipAddress],
        "password" => $devicePass,
        "service" => "pppoe",
        "comment" => $fullAddress
    ));
}

Also, I've tried using this one:

$i = 0;
if($sameNames) {
    for($i = 0; $i < 99999; $i++) {
        $i++;
        $mktApi->comm("/ppp/secret/add", array(
            "name" => $deviceUser . " ($i)",
            "remote-address" => $IPs[$ipAddress],
            "password" => $devicePass,
            "service" => "pppoe",
            "comment" => $fullAddress
        ));
    }
}

but when I create only one name in my list, automatically creates X names and I do not want that.
I've been searching for help on other communities too and somebody provided me this code, but I still get the same error ("user with same name already exists"):

// Start your update here:
$i = 0;
$deviceUser = $deviceUserOriginal = "07NAV" . $var;
$sameNames = false;
do {
    // First - check if a dupe exists...
    $sameNames = $mktApi -> comm("/ppp/secret/getall", array(
        ".proplist" => ".id",
        "?name" => $deviceUser
    ));

    // Second - update and prepare for rechecking ...
    if($sameNames === true) {
        $i ++;
        $deviceUser = $deviceUserOriginal . "(". $i .")";
    }

    // Finally, below, if check failed, cycle and check again with the new updated name...
}
while($sameNames === true);

// Finally, tidy up.
// If you need the original value of $deviceUser you can retain it.
unset($i, $deviceUserOriginal);

// Continue your script here:
$mktApi -> comm("/ppp/secret/add", array(
    "name" => $deviceUser,
    "remote-address" => $IPs[$ipAddress],
    "password" => $devicePass,
    "service" => "pppoe",
    "comment" => $fullAddress
));

Google’s Chrome 97 Release Includes Controversial Keyboard API

Featured Imgs 23

Google’s release of Chrome 97 this week brings along with it the formal introduction of the heavily criticized keyboard API. This API simplifies the identification of key presses in non-standard keyboard layouts, while also introducing potential privacy issues that developers from Apple and Mozzila have criticized.

The Google announcement of the new API outlined the reasons why the company decided to include this API in the Chrome 97 release:

Anariel Design Releases Bricksy, Its Third WordPress Block Theme

Featured Imgs 08

Yesterday, Anariel Design’s third block theme, Bricksy, went live in the WordPress.org directory. Ana Segota, the co-founder and self-proclaimed “creative motor” of the company, has almost become a master at block-based theme design at this point, and this project is just her showing off her skills.

I actually took the theme for a spin over the weekend when I saw it was waiting in the review queue, so I have had a few days to play around with it. Despite a few trivial issues, it has quickly become one of my favorite block themes.

Bricksy WordPress theme home/blog page.  Header shows logo and menu. It is followed by a three-column section of Cover blocks with background images that include a header and button. Following that is a two-column grid of posts.
Bricksy blog page design.

While I have generally liked Anariel Design’s two previous block themes, Naledi and Clove, I could not see myself installing them on a real-world project. They were simply not my personal style. However, Bricksy is a theme I would definitely use if I had a project for it at the moment.

One of my favorite design elements is the cursive handwriting for the site logo, which is also used across various patterns.

Offset three columns of team member sections with images, names, roles, and social links.  In the center, there is a cursive header that reads "freedom," followed by "Our Team".
Team Alternative pattern with cursive header image.

The downside is that these are images, so they are not easily recreated by end-users without Photoshop chops. I would like to see the team reconsider using a handwriting-style font — maybe one from Google Fonts — that allows users to add custom text directly from the editor.

Bricksy has, hands down, some of the most beautifully-designed patterns I have seen in a block theme yet. In total, there are 32.

WordPress block pattern explorer, which displays a categories panel on the left and a three-column grid of patterns on the right.
Bricksy’s general block patterns.

It is making an early bid for my favorite theme of 2022, but I will not get ahead of myself. We still have almost an entire 12 months to go before I make that call.

It even includes a custom social links layout. More and more themes are bundling their own takes on this pattern, but Bricksy’s color scheme and default Cover block image stand out.

Cover block with a background of a pier over a lake. Content contains image, title, subtitle, link buttons, and a social links menu.
Social Links block pattern.

With 32 patterns, I could dedicate an entire post to them all, but I am limited on time. For the most part, they are layout-focused rather than industry-focused patterns. This means they can be used on a vast range of sites. However, the pricing tables and team sections make sense for small businesses. Bricksy also supports WooCommerce.

The most striking thing about each pattern is that they all seem to fit within the theme’s overall design. Often, when themes include dozens of block patterns, some of them can feel like an additional option simply for the sake of adding one more thing in. And, that never feels like the case with Bricksy.

For long-form content, the theme is decent. However, it could be better. Its 720px content width and 18px font size can quickly grow hard to read. Cutting the width anywhere from 80px to 120px makes it much more comfortable. Bumping the font size up a couple of extra pixels works too.

When I first activated the theme, I thought it was utterly broken. I had wondered how it managed to slip through the review system. The theme’s header was outputting seemingly random demo content. But, it was also familiar. I was positive it was a test post from my install.

Header of a website is erroneously displaying the content of a post, which is a table, image, and list.
Nav menu showing a blog post’s content.

The issue was tough to hunt down. After everything from deactivating plugins to scrubbing templates from the database, I finally found it. The ref key for the Navigation block in the theme’s header.html template part was the culprit. Bricksy pointed to a specific post ID in the code:

<!-- wp:navigation {"ref":4790,"layout":{"type":"flex","setCascadingProperties":true,"justifyContent":"right"}} /-->

4790 is the ID of a literal post on my test install, so the Navigation block showed its content instead of a menu. Most likely, this was directly copied or exported from the site editor. Theme authors need to watch out for specific ID references in their code when building from the editor, making sure to remove them before shipping.

Aside from a couple of trivial issues and a single OMGBBQ one after activation, I enjoyed using the theme. It has found its place in my recommended-themes list.

Should CSS Override Default Browser Styles?

Category Image 052

CSS overrides can change the default look of almost anything:

  • You can use CSS to override what a checkbox or radio button looks like, but if you don’t, the checkbox will look like a default checkbox on your operating system and some would say that’s best for accessibility and usability.
  • You can use CSS to override what a select menu looks like, but if you don’t, the select will look like a default select menu on your operating system and some would say that’s best for accessibility and usability.
  • You can override what anchor links look like, but some would say they should be blue with underlines because that is the default and it’s best for accessibility and usability.
  • You can override what scrollbars look like, but if you don’t, the scrollbars will look (and behave) the way default scrollbars do on your operating system, and some would say that’s best for accessibility and usability.

It just goes on and on…

In my experience, everyone has a different line. Nearly everybody styles their buttons. Nearly everybody styles their links, but some might only customize the hue of blue and leave the underline, drawing the line at more elaborate changes. It’s fairly popular to style form elements like checkboxes, radio buttons, and selects, but some people draw the line before that.

Some people draw a line saying you should never change a default cursor, some push that line back to make the cursor into a pointer for created interactive elements, some push that line so far they are OK with custom images as cursors. Some people draw the line with scrollbars saying they should never be customized, while some people implement elaborate designs.

CSS is a language for changing the design of websites. Every ruleset you write likely changes the defaults of something. The lines are relatively fuzzy, but I’d say there is nothing in CSS that should be outright banned from use — it’s more about the styling choices you make. So when you do choose to style something, it remains usable and accessible. Heck, background-color can be terribly abused making for inaccessible and unusable areas of a site, but nobody raises pitchforks over that.


Should CSS Override Default Browser Styles? originally published on CSS-Tricks

What is a landing page?

Featured Imgs 11

A landing page is any web page that a consumer can land on, but in the marketing realm, its usually a standalone page, distinct from your homepage or any other page, that serves a single and focused purpose. A landing page is a follow up to any promises that youve made in your content. Essentially, its the next step toward a visitor becoming a customer. Your landing page lets you make a trade, some sort of special offer, piece of information or a deal, in return for providing contact information.

How to Fix ‘Comments Are Closed’ in WordPress (Beginner’s Guide)

Category Image 091

Are you seeing the ‘Comments are closed’ message on your WordPress posts?

This message is displayed when comments have been disabled on a post. However, some users report seeing the message unexpectedly.

In this article, we’ll show you how to fix ‘Comments are closed’ in WordPress.

How to Fix 'Comments Are Closed' in WordPress (Beginner's Guide)

What Is the ‘Comments Are Closed’ in WordPress Error?

The comment area of your WordPress blog allows your website visitors to give feedback, ask questions, offer their own point of view on the topic, and respond to other comments.

Comments are disabled on all WordPress pages by default, and you won’t see the ‘Comments are Closed’ message on pages. However, you can still follow the steps below to open comments on your pages as well as posts.

For blog posts, you can disable comments on specific posts or on your entire WordPress website. For example, you may wish to disable comments on an announcement post.

When you disable comments on a post that has at least one comment, you will see the message ‘Comments are closed.’ This explains to your visitors that even though there are comments on the post, no further comments can be left.

The 'Comments are closed' Message

If you disable comments on a post that has no comments, then you won’t see the ‘Comments are closed’ message. WordPress will simply not display the comment form.

Perhaps you’re seeing the ‘Comments are closed’ message on your website unexpectedly. While WordPress is easy to use, some error messages can be hard to troubleshoot for beginners. That’s why we put together a list of the 50 most common WordPress errors and how to fix them.

This message is most likely being shown because of a WordPress setting that’s not configured correctly. That’s because WordPress has comments settings in multiple areas, which can make it hard for beginners to find the right settings to fix the problem.

In this post, we’ll walk you through all the settings you should check in order to reopen the comments on your blog posts.

With that being said, let’s look at how to fix ‘Comments are closed’ in WordPress.

Enable Comments on Future Posts

Comments are often closed on a WordPress site because at some time in the past a setting was checked was that disables comments on new posts by default.

You can check this setting by navigating to Settings » Discussion. Here you’ll find a set of checkboxes that control how comments are handled on new posts.

Enable Comments for Future Posts from Settings » Discussion

The first setting to look at is ‘Allow people to post comments on new articles’. This box should be checked so that the default setting for future posts is to allow comments.

Next, look at ‘Automatically close comments on articles older than XX days’. This setting is useful if you don’t want users to be able to comment on older posts. However, if you want to allow comments on all posts, then you should make sure this box is unchecked.

Once you’re happy with the discussion settings, make sure you click the ‘Save Changes’ button at the bottom of the screen to store the settings.

This will make sure comments are open on all new posts you create. But it will not enable them on posts that have already been created.

That’s what we’ll do in the next step.

Enable Comments on a Specific Post

This method will show you how to enable comments on existing posts one at a time. However, if you wish to enable comments on many posts, then you should follow the ‘Enable Comments in Bulk’ method that we cover below.

If you use the block editor on your WordPress site, then you need to scroll down the settings pane on the right of the screen until you come to the Discussion panel.

Now you should click on ‘Discussion’ to expand the options, and then make sure the ‘Allow comments’ box is checked.

Allow Comments on a Post or Page

Once you click the Update button at the top of the screen to save the setting, comments will be enabled for this post.

You should repeat these steps to enable comments on other blog posts. You can also follow the same process to enable comments on WordPress pages.

How to Display the Discussions Panel if It Is Hidden

While the Discussions panel is displayed by default, it may be hidden on your website. If you can’t find it, then you will need to click the Options icon at the top right of the screen. This icon looks like 3 vertical dots.

Post Preferences

You then need to click on ‘Preferences’ and navigate to the ‘Panels’ tab. Once there, you can toggle the ‘Discussions’ switch on so that the panel is displayed.

Toggle the Discussions Panel On

Enable Comments on a Specific Post (Classic Editor)

If you are using the classic editor, then the steps for enabling comments on a post are a little different. Here, the Discussion meta box is hidden by default. To display it, you will need to click on ‘Screen Options‘ at the top right of the screen.

Edit the Post and Click Screen Options

Next, you should check the Discussion box under ‘Screen elements’. After that, simply click ‘Screen Options’ again to return to your post.

Make Sure the Discussions Screen Element is Checked

You can now scroll down to the bottom of your post where you will find the Discussion meta box. You should make sure the ‘Allow comments’ box is checked.

Make Sure Allow Comments Is Checked

After you click the Update button to save the setting, comments will be enabled for this post.

Enable Comments on Posts in Bulk

If you need to enable comments on multiple posts, then you can update them in bulk. To do that, navigate to the Posts » All Posts page where you will find a list of all of your posts.

You need to select the posts that have comments disabled by clicking the checkbox next to each post.

After that, you should choose ‘Edit’ from the Bulk Actions dropdown box and then click the ‘Apply’ button. This will open the bulk edit screen.

Edit Multiple Posts at Once With Bulk Actions

Here you need to click the ‘Comments’ drop down menu and then select ‘Allow’.

Don’t forget to click the ‘Update’ button to change the setting for all selected posts.

Allow Comments for Multiple Posts at Once

How to Select All Posts At Once

If you want to enable comments for every post on your website at once, then following the steps above would take a lot of time if you have hundreds of blog posts on your site.

To do it faster, there are a few extra steps you should take. First, you will need to make sure that all posts are displayed on a single page.

You can see a count of all the posts on your website under the ‘Posts’ title at the top of the screen. If you have 20 posts or less, then they are already displayed on one page. If you have more than 20 posts, then you will have to increase the number of items per page.

To do that, you should click ‘Screen Options’ at the top of the page. Then, under Pagination, find the ‘Number of items per page’ setting. Here you will need to type a number larger than the total number of posts on your site.

Ensure All Your Posts Are Displayed on a Single Page

For example, if you have 65 posts on your website, then you could type the number 70.

After that, you need to click the ‘Apply’ button and all of your posts will be displayed on one page. You can now click ‘Screen Options again to hide the settings.

You can now select every post on your site by simply clicking the checkbox next to ‘Title’.

Click the Checkbox Next to Title to Select All Posts

To enable comments on all of these posts, you should click ‘Bulk Actions’ then ‘Edit’, and follow the steps we covered earlier in this section to change the Comments setting to ‘Allow’.

Note: We don’t recommend trying to update hundreds of blog posts at once if you have slow web hosting, since your site may time out or freeze up before completing all the updates.

Check for Incompatible Themes or Plugins

If you have tried all of the steps above and comments are still disabled on your site, then it may be because of an incompatibility with your theme or one of your plugins.

Sometimes poorly coded WordPress themes may wrongly display the ‘Comments are closed’ message even when comments are open.

To check if your theme is the problem, you should navigate to Appearance » Themes and temporarily activate some other theme.

Enable a Different Theme to See if the Issue Is Resolved

If the ‘Comments are closed’ message is now fixed, then your theme is the problem. You can ask the theme developer to fix the issue. For more details, see our guide on how to properly ask for WordPress support and get it.

Alternatively, if you’re an advanced user, then you can try to fix the issue yourself. You need to refer to our guide on how to disable comments in WordPress, and then follow the instructions under ‘Remove “Comments Are Closed” in WordPress’.

If you think a plugin may be causing the issue, then you can head over to Plugins » Installed Plugins and make sure you haven’t installed a plugin designed to disable comments, such as Disable Comments. If you have, then simply disable that plugin and test to see if comments are now working.

If comments are still closed, then you need to test for incompatible plugins. You’ll need to temporarily deactivate one plugin at a time by clicking its ‘Deactivate’ link.

Deactivate Plugins One at a Time to See if the Issue Is Resolved

Now test to see if comments are enabled on your site. If they are still not working, then this plugin is not the problem. Simply click its ‘Enable’ link and move on to the next plugin.

We hope this tutorial helped you learn how to fix ‘Comments are closed’ in WordPress. You may also want to learn how to increase your blog traffic, or check out our list of the best social media plugins for WordPress.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

The post How to Fix ‘Comments Are Closed’ in WordPress (Beginner’s Guide) first appeared on WPBeginner.

WordPress 5.9 to Fix Lazy Loading Performance Regression, Resulting in 30% Faster Page Loads in Some Cases

Category Image 006

WordPress sites may soon see a slight performance improvement on page loads, thanks to a fix for a performance regression in the core lazy loading feature. An analysis published in July 2021 showed that lazy loading applied too aggressively can have a negative impact on performance and that it’s better to eagerly load the images within the initial viewport.

WordPress’ default of lazy loading all images was causing slower performance on the Largest Contentful Paint metric (LCP) metric, which Google defines as “the render time of the largest image or text block visible within the viewport, relative to when the page first started loading.”

Google-sponsored WordPress contributors wrote a fix that avoids lazy-loading images above the fold and thoroughly tested it as part of their efforts to evaluate the impact of various past performance initiatives. The delayed LCP will be fixed in WordPress 5.9.

“This can be improved by skipping addition of loading='lazy' for the first content image or iframe, which in the vast majority of cases will appear within the initial viewport,” Felix Arntz said in the dev note. “WordPress can only make educated guesses around that and not be 100% certain, but an analysis taking into account 50 popular themes showed that the enhancement brought LCP improvements across the board, up to 30% faster page load.” 

In the future, this implementation may be able to drill down further into the block content on the page and eagerly load whatever images the theme identifies as being within the viewport.

“Have you thought about how we could have more precise heuristics going forwards that can take the semantics and structure of blocks into account to get a sense for what is actually deferrable?” Matias Ventura commented on the ticket in process. “For example, an image block or a site logo used in a header template part would be strong indicatives of being above the fold. ‘The first image of the content’ seems instead like a rudimentary measure, that varies a lot depending on preceding layout. With block themes we should have some ahead-of-time awareness of layout which we can use to produce more meaningful instructions.”

Felix Arntz said he already has detecting the header template part on his radar and is willing to refine the implementation as the world of block themes expands.

“The refinement of the lazy-loading implementation should notably improve LCP performance for most sites that rely on it, while not having adverse effects for sites where the default heuristics described above do not apply to,” Arntz said. “That is only a solid starting point though. In the future, specifically with the more semantic content specification that block-based themes will facilitate, we will be able to further fine tune the lazy-loading implementation by using the available block information.”

get combined textbox text into a new one in sorted checkedbox order

558fe5180e0e8fc922d31c23ef84d240

Hi, I have a question, how can I achieve this, like I have declared 3 variable as string, each checkbox has a variable that will be created if clicked also when checked it will put the corresponding textbox.text into it. Now the problem is I need to make sure that the first one that will be selected will be the first one that will be paste thanks to the variable, the seond checked and third checked same thing. This is the code

 Private Sub CheckBox2_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox2.CheckedChanged
        Dim fntext As String
        Dim artext As String
        Dim dltext As String
        If CheckBox3.Checked = True Then
            fntext = TextBox1.Text
        ElseIf CheckBox4.Checked Then
            artext = TextBox4.Text
        ElseIf CheckBox5.Checked Then
            dltext = TextBox6.Text
        End If
    End Sub
    TextBox7.Text += fntext & vbCrLf & artext & vbCrLf & dltext
End Class

vb net reload filterbox from list saved from settings

558fe5180e0e8fc922d31c23ef84d240

Hi, I have a issues, I have to load again the listbox, after filtering trought a textbox if a string is the same. I tried this code, but doesn't work at the is null or empthy, how can I reload it by a cicle for?

 Private Sub TextBox3_TextChanged(sender As Object, e As EventArgs) Handles TextBox3.TextChanged
        Dim items = From it In ListBox1.Items.Cast(Of Object)()
                    Where it.ToString().IndexOf(TextBox3.Text, StringComparison.CurrentCultureIgnoreCase) >= 0
        Dim matchingItemList As List(Of Object) = items.ToList()
        ListBox1.BeginUpdate()
        ListBox1.Items.Clear()
        For Each item In matchingItemList
            ListBox1.Items.Add(item)
        Next
        If String.IsNullOrEmpty(TextBox3.Text) Then
            ListBox1.Items.AddRange(My.Settings.userlist.ToString)
        End If
        ListBox1.EndUpdate()
    End Sub

2muchcoffee reached Global Top 1000 Company rating

Featured Imgs 23
2muchcoffee reached Global Top 1000 Company rating

There’s no such thing as too much when it comes to the 2muchcoffee team. We’re a Ukrainian-based company that’s the all-around technology partner that’s ready to help you elevate your business. We have vast experience working on different technologies like JavaScript, Ionic, Angular, Nest.js, Next.js, Flutter, REST API, and more.

In honor of our impact, we’ve been recently recognized as a Clutch Global Top 1000 Company this 2021!

2muchcoffee reached Global Top 1000 Company rating

Clutch is a data-driven B2B platform headquartered in the heart of Washington DC. All year round, analysts from the platform research through the different B2B industries to determine which service providers lead their respective markets. Following their 2021 evaluation, Clutch ranks 2muchcoffee as one of the top-performing service providers because of our dedication, market position, and our clients’ success.

This recognition is such a great boost for our confidence! We will continue to aim even higher, and we hope to achieve more momentous milestones like this in the future!

“We are on the right path! Our plan for 2022?  to be recognized among the best 100.” — Chief Executive Officer of 2muchcoffee

Thank you so much to each and every one of our clients! We attribute this wonderful award to you and your team. Without your support, we wouldn’t be here today. If it weren’t for your appreciation and success, 2muchcoffee wouldn’t be a five-star company!

2muchcoffee reached Global Top 1000 Company rating

“2muchccoffee is very diligent which translates to the high quality they deliver. The team’s professionalism, code quality, and responsiveness are their main strengths. Also, this software company is very customer-centric and gave us the impression that they understood the requirements from start to finish.” — Co-Founder & CEO, Scholyr

“2muchcoffee team is communicative and responsive to requests, which results in a supportive partnership. The whole team was very easy to work with. They demonstrated a lot of technical expertise and a very strong understanding of the project and its aims.” — Co-Founder, Health Technology CompanyDo you have an idea for your next project? Not sure what tech stack or business model to choose?

Don’t hesitate to share your thoughts and the 2muchcoffee team will assist you in any inquiry.

How to Display Your Form in a Single Line in WordPress (Easy Way)

Category Image 091

Do you want to display your form in a single line?

Single line forms give you more flexibility with form placement. This means you can easily add forms to high traffic areas of your site and improve your conversions.

In this article, we’ll show you how to display your form in a single line in WordPress easily.

How to display your form in a single line in WordPress (easy way)

Why Display a Single Line Form in WordPress?

Single line forms give you more flexibility when choosing where to place your forms. Since this style of form is only a single line, they don’t take up much space and can easily be integrated with your existing content. 

Email newsletter sign up forms are often displayed in a single line above or below blog post content. Single-line forms also work well on landing pages, contact pages, and other important pages on your website.

Beyond generating more subscribers and leads, you can turn any kind of form into a single line form. For example, it might make sense to display your contact form in a single line to save space on the page. 

That being said, let’s show you how to display a single line form on your WordPress website.

Creating Your Single Line Form in WordPress

For this tutorial, we’ll be using the WPForms plugin to create a single line form. It’s the best lead generation plugin for WordPress used by over 5 million websites.

WPForms

You can use the drag and drop builder to quickly create any form for your site. Plus, it integrates with popular email marketing tools so you can easily grow your email list.

There is a premium version of the plugin with many more features, but we’ll use the lite version for this tutorial since it lets you create a simple form and connect it to Constant Contact for lead generation.

First thing you need to do is install and activate the plugin. For more details, see our beginner’s guide on how to install a WordPress plugin

After that, go to WPForms » Add New in your WordPress admin panel and give your form a name. Then, you need to choose your form template.

We’ll select the ‘Opt-In Form’ template. Simply hover over the template and click the ‘Use Template’ button.

Select form template

This brings up the drag and drop form builder.

You’ll see that the template we chose automatically includes the name and email fields and a submit button.

WPForms drag and drop form builder

Every field can be edited by clicking on them and making changes in the left hand column.

You can also drag and drop the fields to change their order.

WPForms form editor panel

Once you’re done customizing the fields, you can display your form in a single line.

To do this, go to Settings » General and then click on the ‘Advanced’ drop down tab.

Go to form advanced settings

Next, type ‘inline-fields’ in the ‘Form CSS Class’ box (without quotes).

This will apply that CSS class to the form. Since WPForms includes styling for the ‘inline-fields’ class, it will automatically make your entire form display nicely on a single line.

Add inline CSS class

After that, you can make your form even smaller by hiding the field labels.

Simply click on the ‘Fields’ navigation option, then select the ‘Advanced’ menu option, and click the ‘Hide Label’ toggle to turn it on.

Hide form labels toggle

Then, you need to do the same thing for all of the form field labels.

After that, in the same ‘Advanced’ section, you can enter text into the ‘Placeholder’ box. 

This tells your users what each form field is for. 

Add form placeholder text

Once you’re done customizing your form, make sure to click the ‘Save’ button to save your changes.  

If you’re using your form to generate leads, then you can connect your form to your email marketing provider. For more details, see our guide on how to create an email newsletter the right way. 

Adding Your Single Line Form to Your WordPress Website

Now, it’s time to add your single line form to your website. You can add it to any page, post, or widget area.

We’re going to add it to an existing page, but the process will be similar if you’re adding it to another area of your WordPress blog.

Simply open up the page where you want the single line form to display, click the ‘Plus’ add block icon, and search for ‘WPForms’.

Add WPForms block

Then, click on the ‘WPForms’ block to add it to your site.

This brings up a drop down box to choose the single line form you created earlier.

Select single line form from drop down

Once you choose your form, the plugin will load a preview of your form inside the content editor. Then, click the ‘Update’ or ‘Publish’ button to make your new form live.

Now, you can visit your website to see your new form in action. 

Single line form example

We hope this article helped you learn how to display your form in a single line in WordPress. You may also want to see our guide on how to get a free email domain, and our expert picks of the best virtual business phone number apps with free options.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

The post How to Display Your Form in a Single Line in WordPress (Easy Way) first appeared on WPBeginner.

Uncaught Error: Call to undefined function mysql_query()

558fe5180e0e8fc922d31c23ef84d240

Hi I have this PHP Code -

<?php
require_once ("../include/initialize.php");
     if (!isset($_SESSION['ACCOUNT_ID'])){
      redirect(web_root."index.php");
     }

$action = (isset($_GET['action']) && $_GET['action'] != '') ? $_GET['action'] : '';

switch ($action) {
    case 'add' :
    doInsert();
    break;

    case 'edit' :
    doEdit();
    break; 

    case 'delete' :
    doDelete();
    break;

    case 'photos' :
    doupdateimage();
    break;

    case 'checkid' :
    Check_StudentID();
    break;

    }

    function doInsert(){
        if(isset($_POST['save'])){


        if ($_POST['StudentID'] == "" OR $_POST['Firstname'] == "" OR $_POST['Lastname'] == ""
            OR $_POST['Middlename'] == "" OR $_POST['CourseID'] == "none"  OR $_POST['Address'] == "" 
            OR $_POST['ContactNo'] == "") {
            $messageStats = false;
            message("All fields are required!","error");
            redirect('index.php?view=add');
        }else{  

            $birthdate =  $_POST['year'].'-'.$_POST['month'].'-'.$_POST['day'];

            $age = date_diff(date_create($birthdate),date_create('today'))->y;

            if ($age < 15){
            message("Invalid age. 15 years old and above is allowed.", "error");
            redirect("index.php?view=add");

            }else{
                // error message 
                // duplicate student id
                 // date_format(date_create($_POST['BirthDate']),'Y-m-d'); 

                $sql = "SELECT * FROM tblstudent WHERE StudentID='" .$_POST['StudentID']. "'";
                $res = mysql_query($sql) or die(mysql_error());
                $maxrow = mysql_num_rows($res);
                if ($maxrow > 0) { 
                    # code... 
                    message("Student ID already in use!", "error");
                    redirect("index.php?view=add");
                }else{
                    $stud = New Student(); 
                    $stud->StudentID        = $_POST['StudentID'];
                    $stud->Firstname        = $_POST['Firstname']; 
                    $stud->Lastname         = $_POST['Lastname'];
                    $stud->Middlename       = $_POST['Middlename'];
                    $stud->CourseID         = $_POST['CourseID']; 
                    $stud->Address          = $_POST['Address']; 
                    $stud->BirthDate        = $birthdate;
                    $stud->Age              = $age;
                    $stud->Gender           = $_POST['optionsRadios']; 
                    $stud->ContactNo        = $_POST['ContactNo'];
                    $stud->YearLevel        = $_POST['YearLevel'];
                    $stud->create();

                                // $autonum = New Autonumber();  `SUBJ_ID`, `SUBJ_CODE`, `SUBJ_DESCRIPTION`, `UNIT`, `PRE_REQUISITE`, `COURSE_ID`, `AY`, `SEMESTER`
                                // $autonum->auto_update(2);

                    message("New student created successfully!", "success");
                    redirect("index.php");

                }

            }
         }
        }

    }

    function doEdit(){
    if(isset($_POST['save'])){

        if ($_POST['StudentID'] == "" OR $_POST['Firstname'] == "" OR $_POST['Lastname'] == ""
        OR $_POST['Middlename'] == "" OR $_POST['CourseID'] == "none"  OR $_POST['Address'] == "" 
        OR $_POST['ContactNo'] == "") {
            $messageStats = false;
            message("All fields are required!","error");
            redirect('index.php?view=add');
        }else{  

            $birthdate =  $_POST['year'].'-'.$_POST['month'].'-'.$_POST['day'];

            $age = date_diff(date_create($birthdate),date_create('today'))->y;
            if ($age < 15){
               message("Invalid age. 15 years old and above is allowed.", "error");
               redirect("index.php?view=view&id=".$_POST['StudentID']);

            }else{

          // echo  $_POST['optionsRadios']; 
                $stud = New Student(); 
                $stud->StudentID        = $_POST['IDNO'];
                $stud->Firstname        = $_POST['Firstname']; 
                $stud->Lastname         = $_POST['Lastname'];
                $stud->Middlename       = $_POST['Middlename'];
                $stud->CourseID         = $_POST['CourseID']; 
                $stud->Address          = $_POST['Address']; 
                // $stud->BirthDate     = date_format(date_create($_POST['BirthDate']),'Y-m-d');  
                $stud->BirthDate        = $birthdate;
                $stud->Age              = $age;
                $stud->Gender           = $_POST['optionsRadios']; 
                $stud->ContactNo        = $_POST['ContactNo'];
                $stud->YearLevel        = $_POST['YearLevel'];

                $stud->studupdate($_POST['StudentID']);



                message("Student has been updated!", "success");
                redirect("index.php?view=view&id=".$_POST['StudentID']);
            }


        }


    }

} 

    function doDelete(){

        if (isset($_POST['selector'])==''){
        message("Select the records first before you delete!","error");
        redirect('index.php');
        }else{

        $id = $_POST['selector'];
        $key = count($id);

        for($i=0;$i<$key;$i++){

            $subj = New Student();
            $subj->delete($id[$i]);


                // $id =    $_GET['id'];

                // $subj = New Student();
            //      $subj->delete($id);


        }
            message("Student(s) already Deleted!","success");
            redirect('index.php');
        }


    }
    function doupdateimage(){

            $errofile = $_FILES['photo']['error'];
            $type = $_FILES['photo']['type'];
            $temp = $_FILES['photo']['tmp_name'];
            $myfile =$_FILES['photo']['name'];
            $location="photo/".$myfile;


        if ( $errofile > 0) {
                message("No Image Selected!", "error");
                redirect("index.php?view=view&id=". $_GET['id']);
        }else{

                @$file=$_FILES['photo']['tmp_name'];
                @$image= addslashes(file_get_contents($_FILES['photo']['tmp_name']));
                @$image_name= addslashes($_FILES['photo']['name']); 
                @$image_size= getimagesize($_FILES['photo']['tmp_name']);

            if ($image_size==FALSE ) {
                message("Uploaded file is not an image!", "error");
                redirect("index.php?view=view&id=". $_GET['id']);
            }else{
                    //uploading the file
                    move_uploaded_file($temp,"photo/" . $myfile);



                        $stud = New Student();
                        $stud->StudPhoto    = $location;
                        $stud->studupdate($_POST['StudentID']);
                        redirect("index.php?view=view&id=". $_POST['StudentID']);


                    }
            }

        }

    function Check_StudentID(){


        // $stud = New Student();  
        // $res = $stud->single_student($_POST['IDNO']);

        $sql = "SELECT * FROM tblstudent WHERE StudentID='" .$_POST['IDNO']. "'";
        $res = mysql_query($sql) or die(mysql_error());
        $maxrow = mysql_num_rows($res);
        if ($maxrow > 0) { 
            # code...
            echo "Student ID already in use!"; 
        }


    }

?>

And I am getting this error - Fatal error: Uncaught Error: Call to undefined function mysql_query() in C:\xampp\htdocs\attendancemonitoring\student\controller.php:58 Stack trace: #0 C:\xampp\htdocs\attendancemonitoring\student\controller.php(11): doInsert() #1 {main} thrown in C:\xampp\htdocs\attendancemonitoring\student\controller.php on line 58

I needed help im new .